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

Refactoring, organization & packaging updates #9

Merged
merged 24 commits into from
Nov 8, 2022

Conversation

wpbonelli
Copy link
Contributor

@wpbonelli wpbonelli commented Oct 27, 2022

WIP pulling in a few commits from @mjreno's fork plus some updates, dependency pruning, refactoring and expanded documentation. This changeset allows devtools to be consumed by Modflow6, FloPy, or other repositories for shared pytest fixtures, CLI options and utilities. The FloPy dependency is removed. Some utils that were previously here but seem potentially in scope for FloPy are tentatively moved there (e.g. head/budget comparison, grid utils). This package now depends only on numpy and pytest.

  • update setup.cfg with supported Python/OS versions
  • add pytest.ini
  • use pytest --import-mode=importlib in pyproject.toml (recommended by pytest)
  • add scripts folder and pull_request_prepare.py
  • add tests and CI test job
  • various organization/naming updates
    • mftest_context.py -> context.py
    • flattened internal folder structure
  • remove meson_build (MODFLOW 6 tooling can import the equivalent function from pymake if needed)
  • don't explicitly specify what to export in __init__.py (just follow _* naming convention for internals)
  • remove FloPy dependency (so FloPy can consume test utils from this package)
  • remove unneeded/relocated utilities
    • common_regression.py functions can be matched by --package and --model options with generate_tests hook
    • usgsprograms.txt/py are currently used by the modflow6 test framework to retrieve the URL of the latest release, but this can now be handled by FloPy's get-modflow
      • these files are still in pymake, where they are needed to build modflow-related programs
    • head/budget comparison utilities
      • depended on FloPy previously — tentatively moved to FloPy
      • within FloPy's scope? comparing model results seems broadly useful to FloPy users
  • refactor download/unzip utility function
    • use urllib, remove external requests dependency
    • maybe worth considering moving to (or reproducing in) FloPy, providing the ability to automatically download example models (or some small examples could be bundled in the FloPy package) — PyVista for instance does this
  • add shared test fixtures (importable with pytest_plugins = ["modflow_devtools.fixtures"] in conftest.py)
    • misc. utilities (e.g., get current branch, check if URL is reachable)
    • keepable temporary directory fixtures (with CLI options --keep and --keep-failed)
    • fixtures & pytest_generate_tests hook for loading testmodel & example repos
    • CLI option --smoke (short form -S) for smoke testing
      • by default, smoke testing skips tests marked slow, regression or example
      • subset of tests to skip can be overridden in conftest.py downstream
    • markers for conditionally skipping tests based on
      • executable availability
      • installed Python packages
      • operating system
    • minimal framework for reusing test cases with pytest-cases
  • document utilities/fixtures in README.md
  • add DEVELOPER.md
  • draft CI workflow to create & publish release when changes hit main

mjreno and others added 4 commits August 23, 2022 08:33
* refactor/reorganize/rename modules
* remove common_regression and other utilities no longer needed (functionality matched by flopy get-modflow and modflow6 testing updates)
* update setup.cfg with extra dependency groups and supported python/OS versions
* add pytest.ini to project root
* use pytest --import-mode=importlib in pyproject.toml (as recommended in link above)
* add test CI job
* stub tests
@wpbonelli wpbonelli changed the title Organization & packaging updates Refactoring, organization & packaging updates Oct 27, 2022
…imulation -> TestConfig (disambiguate from flopy Simulation), inject targets in TestConfig ctor
@wpbonelli wpbonelli force-pushed the develop branch 3 times, most recently from 5f07148 to a9c2c02 Compare November 1, 2022 19:25
* add DEVELOPER.md with basic install/testing info
* add conftest.py with temp dir and misc fixtures
* add tests for fixtures in conftest.py
* add test for meson_build function
* add PyGithub as test dep to setup.cfg
* checkout modflow6 before testing in CI
@wpbonelli wpbonelli force-pushed the develop branch 4 times, most recently from 425de14 to a20633d Compare November 2, 2022 13:53
* expand README and DEVELOPER.md
* rename/reorganize files
* move grid/dis-related utilities to flopy
* move common test fixtures here from flopy
* move test fixture tests here from flopy
@wpbonelli wpbonelli force-pushed the develop branch 2 times, most recently from 6cf6947 to fbb5e71 Compare November 4, 2022 15:03
@wpbonelli wpbonelli marked this pull request as ready for review November 4, 2022 15:29
@wpbonelli wpbonelli force-pushed the develop branch 4 times, most recently from fa92cbc to 4ea0134 Compare November 6, 2022 16:12
@wpbonelli wpbonelli marked this pull request as ready for review November 7, 2022 19:45
@wpbonelli wpbonelli merged commit 1dcb276 into MODFLOW-USGS:develop Nov 8, 2022
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