Add "doctest" session ...
... to run `xdoctest` against the `velofy` package. Also, install `xdoctest` with only its "colors" extra as the notebooks do not contain doctests.
This commit is contained in:
parent
110c6f755b
commit
32f6540ec3
1 changed files with 68 additions and 61 deletions
26
noxfile.py
26
noxfile.py
|
|
@ -133,6 +133,7 @@ nox.options.sessions = (
|
|||
'format',
|
||||
'lint',
|
||||
'test',
|
||||
'doctest',
|
||||
)
|
||||
|
||||
# Make `uv` use its own Python no matter what
|
||||
|
|
@ -252,6 +253,31 @@ def test_code(session: Session) -> None:
|
|||
session.run('pytest', *(session.posargs or pytest_default_args))
|
||||
|
||||
|
||||
@nox.session(name='doctest', python=MAIN_PYTHON)
|
||||
def test_docstrings(session: Session) -> None:
|
||||
"""Test the code snippets in the docstrings with `xdoctest`.
|
||||
|
||||
By default, all docstrings in the package are checked.
|
||||
|
||||
Extra arguments are forwarded to `xdoctest`.
|
||||
"""
|
||||
start(session)
|
||||
|
||||
install_pinned(session, '.', 'xdoctest[colors]')
|
||||
|
||||
# As `pytest-env` does for `pytest`,
|
||||
# keep `velofy` from connecting to the production database
|
||||
session.env['TESTING'] = 'true'
|
||||
|
||||
session.run(
|
||||
'python',
|
||||
'-m',
|
||||
'xdoctest',
|
||||
PACKAGE_IMPORT_NAME,
|
||||
*(session.posargs or ('all',)),
|
||||
)
|
||||
|
||||
|
||||
@nox.session(name='deps-audit', python=MAIN_PYTHON, reuse_venv=False)
|
||||
def audit_pinned_dependencies(session: Session) -> None:
|
||||
"""Check dependencies for vulnerabilities with `pip-audit`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue