Skip to content
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

Closed
dhermes opened this issue Oct 3, 2014 · 33 comments
Closed

Get doctests in shape to be tested by tox #212

dhermes opened this issue Oct 3, 2014 · 33 comments
Assignees
Labels
🚨 This issue needs some love. testing triage me I really want to be triaged.

Comments

@dhermes
Copy link
Contributor

dhermes commented Oct 3, 2014

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

@dhermes dhermes added the testing label Oct 3, 2014
@jgeewax jgeewax modified the milestone: Core Stable Jan 30, 2015
@tseaver tseaver self-assigned this Feb 9, 2015
@tseaver
Copy link
Contributor

tseaver commented Feb 9, 2015

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.

@tseaver tseaver closed this as completed Feb 9, 2015
@dhermes
Copy link
Contributor Author

dhermes commented Feb 9, 2015

SGTM

@dhermes dhermes reopened this Jul 10, 2015
@dhermes
Copy link
Contributor Author

dhermes commented Jul 10, 2015

@jgeewax
Copy link
Contributor

jgeewax commented Jul 11, 2015

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...)

@tseaver
Copy link
Contributor

tseaver commented Jul 20, 2015

@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.)

@jgeewax
Copy link
Contributor

jgeewax commented Jul 20, 2015

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?

@tseaver
Copy link
Contributor

tseaver commented Jul 20, 2015

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.

@jgeewax
Copy link
Contributor

jgeewax commented Jul 20, 2015

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...

@tseaver
Copy link
Contributor

tseaver commented Jul 20, 2015

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.

@jgeewax
Copy link
Contributor

jgeewax commented Jul 20, 2015 via email

@dhermes
Copy link
Contributor Author

dhermes commented Aug 28, 2015

@tseaver What do we need to do to get doc snippets tested?

@jgeewax
Copy link
Contributor

jgeewax commented Aug 28, 2015

Can't nose do that (--with-doctest)?

@dhermes
Copy link
Contributor Author

dhermes commented Aug 29, 2015

The point of this issue is that the current snippets we have can't be run with a simple nose --with-doctest since they need some kind of set up.

As @tseaver says above they are basically regression tests (we now call them system tests).

@jgeewax
Copy link
Contributor

jgeewax commented Sep 16, 2015

What about having a standard setUp-type method that does stupid mocks for everything?

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.

@dhermes
Copy link
Contributor Author

dhermes commented Sep 16, 2015

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

After making some stab at it, I'm going to abandon this one

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.

@jgeewax
Copy link
Contributor

jgeewax commented Sep 16, 2015

Awesome. Let's dig into this then. Should we create a new issue or continue here?

@dhermes
Copy link
Contributor Author

dhermes commented Sep 16, 2015

Continue here.

@dhermes
Copy link
Contributor Author

dhermes commented Sep 24, 2015

@tseaver Do we have a plan here?

parthea pushed a commit that referenced this issue Jul 6, 2023
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>
parthea pushed a commit that referenced this issue Jul 6, 2023
Source-Link: googleapis/synthtool@69fabae
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:562802bfac02e012a6ac34eda282f81d06e77326b82a32d7bbb1369ff552b387
parthea pushed a commit that referenced this issue Aug 15, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Sep 14, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Sep 20, 2023
* 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>
parthea added a commit that referenced this issue Sep 20, 2023
* 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 <partheniou@google.com>
parthea pushed a commit that referenced this issue Sep 22, 2023
* 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>
parthea pushed a commit that referenced this issue Sep 22, 2023
Source-Link: googleapis/synthtool@26558ba
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:99d90d097e4a4710cc8658ee0b5b963f4426d0e424819787c3ac1405c9a26719
parthea pushed a commit that referenced this issue Sep 22, 2023
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>
parthea pushed a commit that referenced this issue Sep 22, 2023
)

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>
parthea added a commit that referenced this issue Sep 22, 2023
* 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 <partheniou@google.com>
parthea added a commit that referenced this issue Oct 21, 2023
* 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 <partheniou@google.com>
parthea pushed a commit that referenced this issue Oct 21, 2023
[![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#&#8203;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 ([#&#8203;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 ([#&#8203;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 ([#&#8203;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 ([#&#8203;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` ([#&#8203;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 ([#&#8203;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 ([#&#8203;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).
parthea pushed a commit that referenced this issue Oct 21, 2023
* 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>
parthea pushed a commit that referenced this issue Oct 21, 2023
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 🦕
parthea pushed a commit that referenced this issue Oct 21, 2023
[![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#&#8203;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).
parthea pushed a commit that referenced this issue Oct 21, 2023
* 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>
parthea pushed a commit that referenced this issue Oct 21, 2023
Source-Link: googleapis/synthtool@7ff4aad
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244
parthea pushed a commit that referenced this issue Oct 21, 2023
Source-Link: https://togithub.com/googleapis/synthtool/commit/d0f51a0c2a9a6bcca86911eabea9e484baadf64b
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc
parthea pushed a commit that referenced this issue Oct 22, 2023
Source-Link: https://togithub.com/googleapis/synthtool/commit/25083af347468dd5f90f69627420f7d452b6c50e
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e6cbd61f1838d9ff6a31436dfc13717f372a7482a82fc1863ca954ec47bff8c8
parthea pushed a commit that referenced this issue Oct 22, 2023
…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>
parthea pushed a commit that referenced this issue Oct 22, 2023
Source-Link: https://togithub.com/googleapis/synthtool/commit/352b9d4c068ce7c05908172af128b294073bf53c
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7
parthea pushed a commit that referenced this issue Oct 22, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this issue Oct 31, 2023
fix(deps): require proto-plus >= 1.22.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. testing triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

7 participants