-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get doctests in shape to be tested by tox #212
Comments
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. |
SGTM |
Revisiting this based on @tseaver comment in |
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...) |
@jgeewax I'd like to separate the "API documentation" (which uses the
In our case, we would have to test those examples inside an environment like our current |
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? |
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. |
I hear you -- there must be a way to allow The narrative docs are nice, but not nearly as useful to users as the examples in the context of the method... |
I am arguing from the perspective the two kinds of docs are aimed at different classes of users, who need different tone / format:
For an extensive example of documents built using these principals, see Pyramid's narrative docs versus its API reference docs. |
I'm not sure I agree 100%, but regardless, I'm looking for the simple
examples like
http://docs.pylonsproject.org/projects/pyramid/en/latest/api/interfaces.html#pyramid.interfaces.IBeforeRender
I think the narrative documentation is important, however given I'm looking
at a method that "looks like what I want" (common quote from the user
study), why wouldn't I have an example of how to use it ?
|
@tseaver What do we need to do to get doc snippets tested? |
Can't nose do that ( |
The point of this issue is that the current snippets we have can't be run with a simple As @tseaver says above they are basically regression tests (we now call them system tests). |
What about having a standard We're not looking for "does this return the exact values we expected?", we're looking for "does the method signature line up?" or "are there typos or syntax errors?" Anything else I'm fine to catch manually -- and maybe one day we can make these act like regression/system tests, hitting the live APIs. |
I think we could probably build a harness that steps in front and mocks them in the necessary way, it just requires discussion. @tseaver said
But we never had a back and forth and at the time didn't value the proposition very much. UPDATE: Now that its more relevant (as we've seen it keep coming up), it's worth having a discussion. |
Awesome. Let's dig into this then. Should we create a new issue or continue here? |
Continue here. |
@tseaver Do we have a plan here? |
Source-Link: googleapis/synthtool@694118b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ec49167c606648a063d1222220b48119c912562849a0528f35bfb592a9f72737 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@69fabae Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:562802bfac02e012a6ac34eda282f81d06e77326b82a32d7bbb1369ff552b387
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* chore: Use gapic-generator-python 0.65.0 PiperOrigin-RevId: 440970084 Source-Link: googleapis/googleapis@5e0a3d5 Source-Link: googleapis/googleapis-gen@b0c628a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjNjI4YTNmYWRlNzY4ZjIyNWQ3Njk5Mjc5MWVhMWJhMmE4ODFiZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
* fix: test cleanup stages with try finally * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@26558ba Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:99d90d097e4a4710cc8658ee0b5b963f4426d0e424819787c3ac1405c9a26719
Source-Link: googleapis/synthtool@d2871d9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b2dc5f80edcf5d4486c39068c9fa11f7f851d9568eea4dcba130f994ea9b5e97 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
) Source-Link: googleapis/synthtool@c1dd87e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2d13c2172a5d6129c861edaa48b60ead15aeaf58aa75e02d870c4cbdfa63aaba Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* ci(python): run lint / unit tests / docs as GH actions Source-Link: googleapis/synthtool@57be0cd Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 * add commit to trigger gh actions Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: googleapis/googleapis@fea4387 Source-Link: googleapis/googleapis-gen@387b734 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-storage](https://togithub.com/googleapis/python-storage) | `==1.38.0` -> `==1.39.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.39.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.39.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.39.0/compatibility-slim/1.38.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.39.0/confidence-slim/1.38.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-storage</summary> ### [`v1.39.0`](https://togithub.com/googleapis/python-storage/blob/master/CHANGELOG.md#​1390-httpswwwgithubcomgoogleapispython-storagecomparev1380v1390-2021-06-21) [Compare Source](https://togithub.com/googleapis/python-storage/compare/v1.38.0...v1.39.0) ##### Features - media operation retries can be configured using the same interface as with non-media operation ([#​447](https://www.github.com/googleapis/python-storage/issues/447)) ([0dbbb8a](https://www.github.com/googleapis/python-storage/commit/0dbbb8ac17a4b632707485ee6c7cc15e4670efaa)) ##### Bug Fixes - add ConnectionError to default retry ([#​445](https://www.github.com/googleapis/python-storage/issues/445)) ([8344253](https://www.github.com/googleapis/python-storage/commit/8344253a1969b9d04b81f87a6d7bddd3ddb55006)) - apply idempotency policies for ACLs ([#​458](https://www.github.com/googleapis/python-storage/issues/458)) ([2232f38](https://www.github.com/googleapis/python-storage/commit/2232f38933dbdfeb4f6585291794d332771ffdf2)) - replace python lifecycle action parsing ValueError with warning ([#​437](https://www.github.com/googleapis/python-storage/issues/437)) ([2532d50](https://www.github.com/googleapis/python-storage/commit/2532d506b44fc1ef0fa0a996822d29e7459c465a)) - revise blob.compose query parameters `if_generation_match` ([#​454](https://www.github.com/googleapis/python-storage/issues/454)) ([70d19e7](https://www.github.com/googleapis/python-storage/commit/70d19e72831dee112bb07f38b50beef4890c1155)) ##### Documentation - streamline 'timeout' / 'retry' docs in docstrings ([#​461](https://www.github.com/googleapis/python-storage/issues/461)) ([78b2eba](https://www.github.com/googleapis/python-storage/commit/78b2eba81003b437cd24f2b8d269ea2455682507)) - streamline docstrings for conditional parmas ([#​464](https://www.github.com/googleapis/python-storage/issues/464)) ([6999370](https://www.github.com/googleapis/python-storage/commit/69993702390322df07cc2e818003186a47524c2b)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-asset).
* chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: googleapis/googleapis@2921f9f Source-Link: googleapis/googleapis-gen@6598ca8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
added support for python 3.9 and 3.10 Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-kms/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #212 🦕
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-translate](https://togithub.com/googleapis/python-translate) | `==3.2.1` -> `==3.3.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-translate/3.3.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-translate/3.3.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-translate/3.3.1/compatibility-slim/3.2.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-translate/3.3.1/confidence-slim/3.2.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/python-translate</summary> ### [`v3.3.1`](https://togithub.com/googleapis/python-translate/blob/master/CHANGELOG.md#​331-httpswwwgithubcomgoogleapispython-translatecomparev330v331-2021-07-21) [Compare Source](https://togithub.com/googleapis/python-translate/compare/v3.2.1...v3.3.1) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-translate).
These two lines bring the rules on this repo in line with the defaults: https://github.com/googleapis/repo-automation-bots/blob/63c858e539e1f4d9bb8ea66e12f9c0a0de5fef55/packages/sync-repo-settings/src/required-checks.json#L40-L50
* chore: Use gapic-generator-python 0.65.0 PiperOrigin-RevId: 440970084 Source-Link: googleapis/googleapis@5e0a3d5 Source-Link: googleapis/googleapis-gen@b0c628a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjNjI4YTNmYWRlNzY4ZjIyNWQ3Njk5Mjc5MWVhMWJhMmE4ODFiZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@7ff4aad Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244
Source-Link: https://togithub.com/googleapis/synthtool/commit/d0f51a0c2a9a6bcca86911eabea9e484baadf64b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc
Source-Link: https://togithub.com/googleapis/synthtool/commit/25083af347468dd5f90f69627420f7d452b6c50e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e6cbd61f1838d9ff6a31436dfc13717f372a7482a82fc1863ca954ec47bff8c8
…212) Source-Link: googleapis/synthtool@95d9289 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c8878270182edaab99f2927969d4f700c3af265accd472c3425deedff2b7fd93 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: https://togithub.com/googleapis/synthtool/commit/352b9d4c068ce7c05908172af128b294073bf53c Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
fix(deps): require proto-plus >= 1.22.0
Make
tox
test all thedoctests
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
The text was updated successfully, but these errors were encountered: