Skip to content

test: refine pytest skip framework, improve confest.py#1486

Merged
christianlangevin merged 1 commit into
modflowpy:developfrom
mwtoews:pytest-followup
Aug 8, 2022
Merged

test: refine pytest skip framework, improve confest.py#1486
christianlangevin merged 1 commit into
modflowpy:developfrom
mwtoews:pytest-followup

Conversation

@mwtoews
Copy link
Copy Markdown
Contributor

@mwtoews mwtoews commented Aug 7, 2022

This PR builds on the new pytest framework with a few changes:

  • add pytest_report_header to show packages installed (or not). For example, at the top of every pytest run shows something like this:
required packages: numpy-1.23.1, matplotlib-3.5.2
optional packages: pandas-1.4.3, pyshp-2.3.1, python-dateutil-2.8.2, shapely-1.8.2, vtk-9.1.0
optional packages not found: affine, appdirs, descartes, geojson, netcdf4, pyproj, scipy, xmipy, fiona, rasterio
  • remove requires_exes, adjust requires_exe, which takes multiple (e.g.) @requires_exe("mf6", "gridgen")
  • add has_exe, has_pkg, and requires_pkg functions
  • use functions for tests, with a combination of installed packages (nothing too comprehensive, just a few combinations were tested)
  • add run_cmd and run_py_script functions
  • example notebooks and scripts can skip if they use missing optional dependencies
  • update DEVELOPER.md with new changes
  • and other small details, e.g. using git rev-parse --abbrev-ref HEAD to get branch name, etc.

@mwtoews mwtoews requested a review from wpbonelli August 7, 2022 23:51
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 8, 2022

Codecov Report

Merging #1486 (39b0138) into develop (861d556) will decrease coverage by 42.551%.
The diff coverage is n/a.

@@              Coverage Diff               @@
##           develop     #1486        +/-   ##
==============================================
- Coverage   72.493%   29.941%   -42.552%     
==============================================
  Files          250       250                
  Lines        54002     52532      -1470     
==============================================
- Hits         39148     15729     -23419     
- Misses       14854     36803     +21949     
Impacted Files Coverage Δ
flopy/mfusg/mfusgsms.py 6.190% <0.000%> (-91.941%) ⬇️
flopy/mf6/utils/postprocessing.py 9.259% <0.000%> (-88.889%) ⬇️
flopy/seawat/swtvdf.py 8.092% <0.000%> (-88.460%) ⬇️
flopy/modflow/mfevt.py 7.537% <0.000%> (-87.463%) ⬇️
flopy/utils/mtlistfile.py 4.620% <0.000%> (-85.348%) ⬇️
flopy/mf6/utils/lakpak_utils.py 2.097% <0.000%> (-85.315%) ⬇️
flopy/modflow/mfhyd.py 13.223% <0.000%> (-85.124%) ⬇️
flopy/utils/swroutputfile.py 10.714% <0.000%> (-85.079%) ⬇️
flopy/modflow/mfag.py 7.282% <0.000%> (-83.878%) ⬇️
flopy/modflow/mfhob.py 5.923% <0.000%> (-83.005%) ⬇️
... and 205 more

* add "pytest_report_header" to show packages installed (or not)
* remove "requires_exes", adjust "requires_exe"
* add "has_exe", "has_pkg", and "requires_pkg" functions
* use functions for tests, with a combination of installed packages
* add "run_cmd" and "run_py_script" functions
* example notebooks and scripts can skip if they use missing optional dep
* update DEVELOPER.md with new changes
@christianlangevin christianlangevin merged commit d892182 into modflowpy:develop Aug 8, 2022
@mwtoews mwtoews deleted the pytest-followup branch September 29, 2022 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants