File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ import pathlib
2+
3+ from _pytest .nodes import Collector
4+ from _pytest .doctest import DoctestModule
5+
6+ collect_ignore = ["src/scripts/cysignals-CSI-helper.py" ]
7+
8+ """Collect doctests in cython files and run them as test modules."""
9+ def pytest_collect_file (
10+ file_path : pathlib .Path ,
11+ parent : Collector ,
12+ ) -> DoctestModule | None :
13+ config = parent .config
14+ if file_path .suffix == ".pyx" :
15+ if config .option .doctestmodules :
16+ return DoctestModule .from_parent (parent , path = file_path )
17+ return None
Original file line number Diff line number Diff line change @@ -31,3 +31,7 @@ classifiers = [
3131]
3232urls = { Homepage = " https://github.com/sagemath/cysignals" }
3333requires-python = " >=3.9"
34+
35+ [tool .pytest .ini_options ]
36+ addopts = " --doctest-modules"
37+ norecursedirs = " builddir docs"
You can’t perform that action at this time.
0 commit comments