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 — Test all the doc snippets · Issue #2535 · googleapis/google-cloud-python

Test all the doc snippets #2535

New issue
Copy link
New issue
Copy link
Closed
Closed
Test all the doc snippets#2535
Copy link
Assignees
daspecstertseaver
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.testing

Description

@daspecster
daspecster
opened on Oct 12, 2016
Issue body actions

Per @dhermes and @tseaver's conversation.

Services with tested snippets

  • Add validation script to check for untested snippets.
  • Start running snippets during system tests.
  • Bigquery (docs/bigquery_snippets.py) (partial)
  • Bigtable
  • Datastore
  • DNS
  • Error Reporting
  • Language
  • Logging
  • Montoring
  • Pubsub (docs/pubsub_snippets.py)
  • Resource manager
  • Speech
  • Storage
  • Translate
  • Vision

Activity

  1. daspecster
    added
    docs
    testing
    on Oct 12, 2016
  2. daspecster
    assigned
    daspecster
    ,
    tseaver
    and
    dhermes
    on Oct 12, 2016
  3. dhermes commented on Oct 12, 2016

    @dhermes
    dhermes
    on Oct 12, 2016
    Contributor
    More actions

    We may want a script which explicitly checks and (complains about / errors in the presence of) snippets in RST files or docstrings?

  4. daspecster commented on Oct 12, 2016

    @daspecster
    daspecster
    on Oct 12, 2016
    ContributorAuthor
    More actions

    @dhermes you mean check for unmarked snippets/code blocks? Can you clarify that?

    Use system test environment?

    I think @tseaver mentioned something about not wanting to write a lot of mocks for snippets?
    With that in mind, couldn't we just test the snippets through the system tests? That seems like the most direct testing strategy.

  5. dhermes commented on Oct 12, 2016

    @dhermes
    dhermes
    on Oct 12, 2016
    Contributor
    More actions

    @daspecster Not sure what you mean by unmarked. I simply mean a script which makes sure all of our snippets must be valid and test-able. So if there is just some code-block somewhere without doctest, then we flag it as untested.

  6. daspecster commented on Oct 12, 2016

    @daspecster
    daspecster
    on Oct 12, 2016
    ContributorAuthor
    More actions

    @dhermes gotcha.

    Snippets are referenced via...

    .. literalinclude:: bigquery_snippets.py
       :start-after: [START client_list_datasets]
       :end-before: [END client_list_datasets]

    So you could just check for .. code-block::'s or ::'s.
    However I don't know if we would want to test things like...

    .. code-block:: console
    
        $ pip install google-cloud

    Could just look for .. code-block:: python I suppose.

  7. dhermes commented on Oct 12, 2016

    @dhermes
    dhermes
    on Oct 12, 2016
    Contributor
    More actions

    @daspecster Yeah I wasn't trying to spec out how the script would work, just trying to say we should have a check. Otherwise snippets may leak in. There might be a Sphinx extension to check for it already?

  8. daspecster commented on Oct 12, 2016

    @daspecster
    daspecster
    on Oct 12, 2016
    ContributorAuthor
    More actions

    Yeah sorry, probably the wrong place to spec it out. I added a checkbox for a validation script.

  9. dhermes commented on Oct 13, 2016

    @dhermes
    dhermes
    on Oct 13, 2016
    Contributor
    More actions

    Proof of concept: dhermes/ci-diff-helper@bfbff87

    I did something similar in google-cloud-python to get an idea of the code-block's we have:
    dhermes@f513290

    (Worth noting that a literalinclude becomes a code block.)

    Reacted by Thomas Schultz
  10. tseaver commented on Oct 14, 2016

    @tseaver
    tseaver
    on Oct 14, 2016
    Contributor
    More actions

    @dhermes Our goals for testing snippets inline:

    • Snippets have no syntax errors. We could mock everything to satisfy this case.
    • Snippets calls to each API match their signatures. Here, we would have to mock things at the connection / stub / helper level. We would still not catch stuff where the values passed in matched the names of expected arguments, but failed to marshal properly, or match what the back-end mandates in some other way.
    • Snippets show actually correct processing of results as they would be returned by the API. Here we would be required to mock everything about the back-end for each API.

    I don't believe we can reasonably expect to do the second or third options inside the test setup / teardown facilities provided by Sphinx. Exercising the snippets in a system-test-like environment, against the real APIs, seems like the only viable choice.

    Reacted by Thomas Schultz
  11. dhermes commented on Oct 14, 2016

    @dhermes
    dhermes
    on Oct 14, 2016
    Contributor
    More actions

    @tseaver That's fine with me. (The thing I spec-ed out was really just to show how we could make sure the literal blocks adhere to whatever standards we desire. So if we wanted them all to be literalinclude we could check for that.)

  12. lukesneeringer
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Apr 19, 2017
  13. lukesneeringer commented on Aug 11, 2017

    @lukesneeringer
    lukesneeringer
    on Aug 11, 2017
    Contributor
    More actions

    Hello,
    One of the challenges of maintaining a large open source project is that sometimes, you can bite off more than you can chew. As the lead maintainer of google-cloud-python, I can definitely say that I have let the issues here pile up.

    As part of trying to get things under control (as well as to empower us to provide better customer service in the future), I am declaring a "bankruptcy" of sorts on many of the old issues, especially those likely to have been addressed or made obsolete by more recent updates.

    My goal is to close stale issues whose relevance or solution is no longer immediately evident, and which appear to be of lower importance. I believe in good faith that this is one of those issues, but I am scanning quickly and may occasionally be wrong. If this is an issue of high importance, please comment here and we will reconsider. If this is an issue whose solution is trivial, please consider providing a pull request.

    Thank you!

  14. lukesneeringer
    closed this as completedon Aug 11, 2017
  15. dhermes commented on Aug 11, 2017

    @dhermes
    dhermes
    on Aug 11, 2017
    Contributor
    More actions

    @lukesneeringer This should definitely be done. I actually have a simple Sphinx extension which requires that all code blocks are either doctests or not Python. We could easily enforce a "no snippets that aren't doctested" policy using that.

  16. theacodes
    unassigned
    dhermes
    on Sep 28, 2018
  17. parthea
    added a commit that references this issue on Mar 9, 2026

    docs: add samples from spanner/cloud-client (#117)

    ffb249b
  18. chalmerlowe
    added 2 commits that reference this issue on Mar 31, 2026

    docs: Rename Blob column references to ObjectRef column (#2535)

    3eb9489

    chore: librarian release pull request: 20260331T225508Z (#2547)

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

Metadata

Metadata

Assignees

  • @daspecster
    daspecster
  • @tseaver
    tseaver

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.testing

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.