Repository navigation
Run docstring doctests in CI as their own job - #4011
Conversation
|
Half 2 of 2 from the #3864 split. Depends on #4010 — eight of the ten On the red checks: they are a repo-wide break, not this change. The |
| [tool.pytest.ini_options] | ||
| # Applied to docstring examples collected via `pytest --doctest-modules`. | ||
| doctest_optionflags = ["ELLIPSIS", "NORMALIZE_WHITESPACE"] | ||
|
|
`mesa/` carries `>>>` examples in ten modules, and nothing runs them, so
they rot silently. Add a `doctest` job to build_lint.yml that runs
pytest --doctest-modules mesa --ignore=mesa/examples
on Python 3.14, matching the existing coverage job.
It is a separate job rather than part of the `build` matrix or the docs
build so that a rotten docstring is reported on its own, instead of
appearing as a unit-test failure or a docs-build failure. That is
@falloficaruss's suggestion on mesa#3825.
`mesa/examples` is excluded: it has no doctests, every `app.py` builds a
model and a renderer at import time, and `st_app.py` imports streamlit,
which is not a dependency.
`pyproject.toml` gains `doctest_optionflags = ["ELLIPSIS",
"NORMALIZE_WHITESPACE"]` under `[tool.pytest.ini_options]`. There is no
`addopts`, so the normal suite is untouched: `pytest tests/ --collect-only`
reports 1016 tests both with and without the block.
This is the second half of mesa#3864, split on request. The first half, the
docstring repairs in mesa#4010, is merged, so this job is green on arrival.
Closes mesa#3825.
Co-Authored-By: Claude Opus 5 <[email protected]>
4ed6bcb to
9884a21
Compare
|
Thanks for merging #4010, @quaquel. Rebased this onto it, so the PR is now a single commit touching two files: the I had also pushed the solara/websockets Verified on the current |
Split out of #3864 at @quaquel's request. This is half 2 of 2.
Depends on the docstring-repair PR — without it this job is red on arrival, because eight of the ten
>>>examples undermesa/cannot execute as written. Please merge that one first.What this adds
A
doctestjob inbuild_lint.yml:on Python 3.14, matching the existing
coveragejob's setup.It is a job of its own rather than part of the
buildmatrix or the docs build, so a rotten docstring is reported as a rotten docstring instead of surfacing as a unit-test failure or a docs-build failure. That was @falloficaruss's suggestion on #3825.On the three-activity framing from #3864 — build the docs, run the normal test suite, run the docstring tests — this is the third, kept out of the other two deliberately. Happy to fold it into either if you would rather have fewer jobs.
pyproject.tomlNo
addopts, so the normal suite is untouched.pytest tests/ --collect-onlyreports 1016 tests both with and without this block, and there was no other pytest config in the repo (nopytest.ini,setup.cfgortox.ini) for it to conflict with.Why
mesa/examplesis excludedIt has no doctests, every
app.pybuilds a model and a renderer at import time, andst_app.pyimports streamlit, which is not a dependency.Verification
The exact command the job runs, locally on this branch:
The workflow file parses as YAML with jobs
build, coverage, doctest, examples, and uses the sameactions/checkout@v7/actions/setup-python@v7pins as every other job in it.Closes #3825. Replaces the CI half of #3864.