modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
507 stars 307 forks source link

test: show test package extras in pytest report header #2181

Closed mwtoews closed 4 months ago

mwtoews commented 4 months ago

This minor enhancement will expand the pytest header to show which packages and versions from the "test" extra are installed. It should help in situations like #2180


New header would look something like this:

============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-8.2.0, pluggy-1.5.0 -- /opt/hostedtoolcache/Python/3.8.18/x64/bin/python
cachedir: .pytest_cache
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
required packages: numpy-1.24.4, matplotlib-3.7.5, pandas-2.0.3
optional packages: affine-2.4.0, descartes-1.1.0, fiona-1.9.6, geojson-3.1.0, geopandas-0.13.2, imageio-2.34.1, netcdf4-1.6.5, pymetis-2023.1.1, pyproj-3.5.0, pyshp-2.3.1, pyvista-0.43.7, rasterio-1.3.10, rasterstats-0.19.0, scipy-1.10.1, shapely-2.0.4, vtk-9.3.0, xmipy-1.4.0
test packages: flopy-3.7.0.dev0, coverage-7.5.1, flaky-3.8.1, filelock-3.14.0, jupyter-1.0.0, jupytext-1.2, modflow-devtools-1.4.0, pytest-8.2.0, pytest-benchmark-4.0.0, pytest-cov-5.0.0, pytest-dotenv-0.5.2, pytest-xdist-3.6.1, pyzmq-26.0.3, syrupy-4.6.1, virtualenv-20.26.1
rootdir: /home/runner/work/flopy/flopy/autotest
configfile: pytest.ini
plugins: anyio-4.3.0, syrupy-4.6.1, flaky-3.8.1, benchmark-4.0.0, dotenv-0.5.2, cov-5.0.0, xdist-3.6.1
created: 2/2 workers
2 workers [1342 items]

note that there is a bit of overlap between "test packages" and "plugins", e.g. "pytest-xdist-3.6.1" and "xdist-3.6.1". However, I'm not sure if packages and pytest plugins can be easily distinguished to reduce the repetition.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 71.0%. Comparing base (029a4e1) to head (ad759a1). Report is 12 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #2181 +/- ## ========================================= + Coverage 68.3% 71.0% +2.7% ========================================= Files 260 261 +1 Lines 57947 58078 +131 ========================================= + Hits 39611 41273 +1662 + Misses 18336 16805 -1531 ``` [see 140 files with indirect coverage changes](https://app.codecov.io/gh/modflowpy/flopy/pull/2181/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=modflowpy)