Skip to content

Add better doctest integration into pytest #228

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

Merged
merged 1 commit into from
Mar 16, 2020

Conversation

tomschr
Copy link
Member

@tomschr tomschr commented Mar 14, 2020

This PR is not based on a specific issue; it just evolved after having the idea of better integrate doctests in our documentation with pytest. 😉

Our documentation contains some examples which can be considered as doctests. As pytest supports doctests, we could use this features to check if the examples in our documentation are still correct.

This PR contains the following changes:

  • Fix typos in README.rst.
  • Move coerce() function into separate file; this was needed so it can be both included into the documentation and inside conftest.py.
  • In docs/usage.rst:
    • Fix typos
    • Add missing semver module name as prefix
    • Slightly rewrite some doctests which involves dicts (unfortunately, order matters still in Python2).
  • In setup.cfg:
    • Add --doctest-glob option to look for all *.rst files.
    • Add testpaths key to restrict testing paths to current dir and docs.

I think, this is a huge benefit as it reduces typos in our documentation or prevents outdated information (they would be reported as errors).

@tomschr tomschr added the Infra All about infrastructure (GitHub Action, project build etc.) label Mar 14, 2020
@tomschr tomschr requested a review from a team March 14, 2020 17:16
@tomschr tomschr self-assigned this Mar 14, 2020
Copy link
Member

@ppkt ppkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, no remarks from me :)

* Fix typos in `README.rst`.
* Move `coerce()` function into separate file; this was needed
  so it can be both included into the documentation and inside
  `conftest.py`.
* In `docs/usage.rst`:
  - Fix typos
  - Add missing semver module name as prefix
  - Slightly rewrite some doctests which involves dicts
    (unfortunately, order matters still in Python2)
* In `setup.cfg`:
  - Add `--doctest-glob` option to look for all `*.rst` files.
  - Add `testpaths` key to restrict testing paths to current dir
    and `docs`.
* Update `CHANGELOG.rst`
@tomschr tomschr force-pushed the feature/integrate-doctests branch from 088045a to 6669ba0 Compare March 15, 2020 10:15
@tomschr
Copy link
Member Author

tomschr commented Mar 15, 2020

I will merge this PR tomorrow if noone objects. 😉

@tomschr
Copy link
Member Author

tomschr commented Mar 16, 2020

As nobody objected and it doesn't involve a lot of magic, I'm going to merge it now.

@tomschr tomschr merged commit 158f19f into python-semver:master Mar 16, 2020
@tomschr tomschr deleted the feature/integrate-doctests branch March 16, 2020 08:22
@s-celles
Copy link
Member

+1 sorry I'm very busy because of COVID-19 in France. Setting up online courses with our Moodle platform.

@tomschr
Copy link
Member Author

tomschr commented Mar 16, 2020

@scls19fr No problem. 👍 I hope I wasn't too quick for this. I leave more time for the other pull requests as they need more time to review. 😉

Wish you all the best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infra All about infrastructure (GitHub Action, project build etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy