GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Get doctests in shape to be tested by tox · Issue #212 · googleapis/google-cloud-python

Get doctests in shape to be tested by tox #212

New issue
Copy link
New issue
Copy link
Closed
Closed
Get doctests in shape to be tested by tox#212
Copy link
Assignees
tseaver
Labels
🚨This issue needs some love.testingtriage meI really want to be triaged.

Description

@dhermes
dhermes
opened on Oct 3, 2014
Issue body actions

Make tox test all the doctests in the Sphinx docs.

Ours aren't in shape to do that (yet, might be hard to get there).

See comment by @tseaver for more context

Activity

Next
  1. dhermes
    added
    testing
    on Oct 3, 2014
  2. jgeewax
    modified the milestone: This milestone has been deleted on Jan 30, 2015
  3. tseaver
    self-assigned this
    on Feb 9, 2015
  4. tseaver commented on Feb 9, 2015

    @tseaver
    tseaver
    on Feb 9, 2015
    Contributor
    More actions

    After making some stab at it, I'm going to abandon this one: the doctest snippets are basically regression-like tests, and can't be exercised without having those environment variables set up.

  5. tseaver
    closed this as completedon Feb 9, 2015
  6. dhermes commented on Feb 9, 2015

    @dhermes
    dhermes
    on Feb 9, 2015
    ContributorAuthor
    More actions

    SGTM

  7. dhermes
    reopened this on Jul 10, 2015
  8. dhermes commented on Jul 10, 2015

    @dhermes
    dhermes
    on Jul 10, 2015
    ContributorAuthor
    More actions

    Revisiting this based on @tseaver comment in
    dhermes@1b1fb11#commitcomment-12114109
    and
    #933 (comment)
    googleapis/google-cloud-node#627

  9. jgeewax commented on Jul 11, 2015

    @jgeewax
    jgeewax
    on Jul 11, 2015
    Contributor
    More actions

    Wait -- those comments sounded like they were saying "we shouldn't test the examples in docstrings".

    I'm glad this is re-opened though. Should we instead make a call on what the proper environment is to run these tests? (I'd expect to have the system-test-like environment in place when running docstring examples...)

  10. tseaver commented on Jul 20, 2015

    @tseaver
    tseaver
    on Jul 20, 2015
    Contributor
    More actions

    @jgeewax I'd like to separate the "API documentation" (which uses the :type foo: / :param foo: / :rtype: / :returns: / :raises: markers to specify the contract) from the examples used to support narrative: I believe the best place for those examples is in Sphinx .. doctest:: sections. I've made such examples testable on other projects: see, for instance, zope.component:

    • its tox.ni uses sphinx-build -b doctest to exercise the snippets.
    • see the configure.rst document uses .. testsetup:: and .. testcleanup:: to handle "offstage" setup / teardown.

    In our case, we would have to test those examples inside an environment like our current system-tests (with appropriate credentials, etc.)

  11. jgeewax commented on Jul 20, 2015

    @jgeewax
    jgeewax
    on Jul 20, 2015
    Contributor
    More actions

    I'm not super concerned about where the tests live, but I really do want the examples near the methods, ie https://googlecloudplatform.github.io/gcloud-python/latest/storage-buckets.html#gcloud.storage.bucket.Bucket.delete_blob

    Does that change anything?

  12. tseaver commented on Jul 20, 2015

    @tseaver
    tseaver
    on Jul 20, 2015
    Contributor
    More actions

    If we leave the examples embedded in method docstrings, we are pretty much giving up on testing them: the Sphinx facilities for doing setup / teardown are not going to mesh with that choice. Moving the examples to narrative docs allows for testing them, as well as giving the method docstrings tighter focus.

  13. jgeewax commented on Jul 20, 2015

    @jgeewax
    jgeewax
    on Jul 20, 2015
    Contributor
    More actions

    I hear you -- there must be a way to allow .. doctest:: or .. example:: sections in a docstring to be tested, and still live alongside the methods...

    The narrative docs are nice, but not nearly as useful to users as the examples in the context of the method...

  14. tseaver commented on Jul 20, 2015

    @tseaver
    tseaver
    on Jul 20, 2015
    Contributor
    More actions

    I am arguing from the perspective the two kinds of docs are aimed at different classes of users, who need different tone / format:

    • Well-structured narrative docs with good examples are aimed at users who are new to the library, and need the "guided tour" approach which the examples support. They focus on the "main path" / common case, and expose the new user to concepts in an order which aids them in building an understanding of why to use various features, more than the nitty-gritty details. In Sphinx, the narrative docs should always contain links to the appropriate sections of the reference docs.
    • API reference docs are most useful for refreshing an experienced user's memory of an API's precise signature / contract: conciseness / precision is most helpful for them. Building explicit references from the reference docs is tricky / confusing, because the narrative docs may have multiple locations which discuss a given API.

    For an extensive example of documents built using these principals, see Pyramid's narrative docs versus its API reference docs.

  15. 98 remaining items

  16. parthea
    added 12 commits that reference this issue on Nov 24, 2025

    fix: Pass port range from `get_user_credentials` to `find_open_port` (#…

    fa14074

    chore: release 1.16.0 (#212)

    d3ba015

    fix!: drop support for Python 2.7 / 3.5 (#212)

    9b4afa8

    chore: release 2.0.0 (#254)

    a4e853d

    chore: pin 'google-auth' to allow 2.x versions (#212)

    7a222c6

    chore: drop mention of Python 2.7 from templates (#212)

    6596fb3

    build: ignore warning from google-auth (#212)

    097dd49

    fix: harden version data gathering against DistributionNotFound (#212)

    a9a112f

    chore(deps): update dependency google-cloud-bigquery to v2.11.0 (#212)

    229436a

    Allow class member values in projection and distinct queries (#214)

    2095019

    chore(deps): update dependency google-cloud-bigquery to v2.11.0 (#212)

    b714aeb

    Merge pull request #212 from dhermes/six-raise-from

    889b784
  17. parthea
    added a commit that references this issue on Mar 2, 2026

    chore: add SECURITY.md (#212)

    d94bc79
  18. parthea
    added 2 commits that reference this issue on Mar 9, 2026

    chore(packaging): prep for grmp-1.0.0 release (#212)

    4170669

    chore: release 1.30.0 (#191)

    2cfabf3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tseaver
    tseaver

Labels

🚨This issue needs some love.testingtriage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.