Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tests): #1066

Merged
merged 4 commits into from
Jan 18, 2023
Merged

Conversation

wpbonelli
Copy link
Contributor

@wpbonelli wpbonelli commented Oct 17, 2022

Follows up on #1130 and picks up some threads originally in #1052

  • Use keepable temp dir fixtures and smoke testing marker/CLI option from modflow-devtools
  • Add smoke test job to ci.yml, only trigger matrix jobs if smoke tests pass
  • Remove pymake as a testing dependency, replace pymake and local utility usages with devtools or FloPy equivalents
    • files removed:
      • disu_util.py
      • binary_file_writer.py
      • budget_file_compare.py
    • moved autotest/scripts/cross_section_functions.py -> autotest/cross_section_functions.py for import without altering sys.path
  • Add optional --path (short -p) argument to update_flopy.py CLI, defaults to existing location doc/mf6io/mf6ivar/dfn
    • script can also be run with pytest, in which case pytest-order is used for ordering
  • Partially refactor a subset of GWF tests with pytest-cases. This is a proof of concept for decoupling test cases from test functions, meant to demo how existing test cases could be incrementally refactored to plug into a shared test function. Implementations range from a minimal switch to pytest-cases, keeping things in the original file, to more extensive refactoring using the Case utility from devtools. Affected files include:
  • Rename Simulation to TestSimulation to disambiguate from Flopy and ModflowAPI
  • Rename testing_framework to TestFramework (shared test function could replace framework class if refactor proceeds)
  • Require flopy (remove try/except imports) since it's documented in DEVELOPER.md and included in environment.yml
  • Remove extra code allowing test scripts to be run directly with python (without pytest) — tests depend on several pytest features so it seems reasonable to require it as a testing dependency, and --original-regression, --model and --package filtering options are now supported by pytest.
  • Provide REPOS_PATH env var to testing steps in CI. This is not strictly required since the repos are checked out to the default search location used by devtools (level with modflow6) but probably still best to be explicit.
  • Update/expand DEVELOPER.md to reflect updates described here. The recent changes should be mostly transparent but if errors are encountered in a local development environment, some things to check include:

wpbonelli and others added 2 commits January 17, 2023 15:46
* use keepable temporary dirs instead of manually managed temp folder
* use pytest-order and add optional --path arg to update_flopy.py CLI
* remove binary_file_writer.py, disu_util.py, budget_file_compare.py
* rename Simulation -> TestSimulation and Framework -> TestFramework
* partially refactor gwf test scripts with pytest-cases
* remove mfpymake as a testing dependency
@wpbonelli wpbonelli force-pushed the refactor-tests branch 2 times, most recently from 08ea367 to 33d7e9b Compare January 17, 2023 21:38
@langevin-usgs langevin-usgs merged commit e51530c into MODFLOW-USGS:develop Jan 18, 2023
@wpbonelli wpbonelli deleted the refactor-tests branch January 18, 2023 18:28
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.

2 participants