Add doctests to the test suite
- use xdoctest to validate code snippets in docstrings
- make xdoctest part of the nox session "test" via
the new `test_docstrings()` test case
- add nox session "test-docstrings" for convenience;
also, `xdoctest.doctest_module()` does not discover
docstrings that are imported at the root of the package
=> each new module with docstrings must be added to
`test_docstrings()` by hand, which is likely forgotten
=> the nox session "test-docstrings" should run on CI
This commit is contained in:
parent
4100a7f3f5
commit
01d270e39c
5 changed files with 76 additions and 2 deletions
|
|
@ -65,6 +65,7 @@ pytest = "^8.3"
|
|||
pytest-cov = "^5.0"
|
||||
semver = "^3.0" # to test the version identifier
|
||||
tomli = [ { python = "<3.11", version = "^2.0" } ]
|
||||
xdoctest = { extras = ["colors"], version = "^1.2" }
|
||||
|
||||
[tool.poetry.urls]
|
||||
|
||||
|
|
@ -264,6 +265,7 @@ module = [
|
|||
"pytest",
|
||||
"semver",
|
||||
"tomli",
|
||||
"xdoctest",
|
||||
]
|
||||
ignore_missing_imports = true
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue