scipy / scipy_doctest

Floating-point aware doctesting
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Refactor `pytest_collection_modify` hook #107

Closed ev-br closed 6 months ago

ev-br commented 6 months ago

Refactor the doctest collection stage a bit.

The key simplifications are

E   _pytest.pathlib.ImportPathMismatchError: ('scipy.signal._spectral', '/home/br/repos/scipy/scipy/build-install/lib/python3.10/site-packages/scipy/signal/_spectral.cpython-310-x86_64-linux-gnu.so', PosixPath('/home/br/repos/scipy/scipy/build-install/lib/python3.10/site-packages/scipy/signal/_spectral.py'))

This probably needs to be looked at on the scipy side.

The full stanza to run this, including pytest ignores, is currently (I know)

$ python dev.py shell
$ cd ~/repos/scipy/scipy
$ PY_IGNORE_IMPORTMISMATCH=1 pytest build-install/lib/python3.10/site-packages/scipy/ --doctest-modules --ignore=build-install/lib/python3.10/site-packages/scipy/interpolate/_interpnd_info.py --ignore=build-install/lib/python3.10/site-packages/scipy/_lib --collect-only

Log posprocessing scripts are below the fold:

``` $ cat modify_log.py # convert the result of # $ pytest ... --doctest-modules --collect-only # to simplify comparing to the doctest_.log from doctest-based runs PACKAGE = "scipy." if __name__ == "__main__": import sys if len(sys.argv) != 2: print("Usage: modify_log.py LOGFILE") fname = sys.argv[1] with open(fname, 'r') as inf: in_lines = inf.readlines() out_lines = [] for line in in_lines: line_ = line.strip() if line_.startswith("

With these, the logs agree for the following combination: https://github.com/ev-br/scipy/tree/doctest_plugin + this PR, and https://github.com/scipy/scipy/pull/16391, modulo https://github.com/ev-br/scpdt/issues/106.

ev-br commented 6 months ago

@Sheila-nk @melissawm any chance you could review this PR? Would be much appreciated.

ev-br commented 6 months ago

https://github.com/scipy/scipy/pull/20112 should take care of IGNORE_IMPORTSMISMATCH

ev-br commented 6 months ago

Merging now to keep the ball rolling as I work on test errors after collection is successful. A post-merge review would still be most welcome.