Add better doctest integration into pytest #228
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
README.rst
.coerce()
function into separate file; this was needed so it can be both included into the documentation and insideconftest.py
.docs/usage.rst
:setup.cfg
:--doctest-glob
option to look for all*.rst
files.testpaths
key to restrict testing paths to current dir anddocs
.I think, this is a huge benefit as it reduces typos in our documentation or prevents outdated information (they would be reported as errors).