Skip to content

Commit

Permalink
refactor(tests): (#1066)
Browse files Browse the repository at this point in the history
* refactor(tests): refactor test framework

* 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

* chore(tests): remove print statements referencing pymake

* chore(tests): add large model test marker to pytest.ini

* fix(tests): use keepable tmpdirs in pytest-cases POC
  • Loading branch information
wpbonelli authored Jan 18, 2023
1 parent 31f1e94 commit e51530c
Show file tree
Hide file tree
Showing 211 changed files with 5,585 additions and 14,195 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,66 @@ jobs:
- name: Meson test
run: meson test --verbose --no-rebuild -C builddir

smoke_test:
name: Smoke test (gfortran 12)
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
env:
FC: gfortran
GCC_V: 12
steps:
- name: Checkout modflow6
uses: actions/checkout@v3
with:
path: modflow6

- name: Setup GNU Fortran ${{ env.GCC_V }}
uses: awvwgk/setup-fortran@main
with:
compiler: gcc
version: ${{ env.GCC_V }}

- name: Setup Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: modflow6/environment.yml
cache-downloads: true
cache-env: true

- name: Build modflow6
working-directory: modflow6
run: |
meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin
meson install -C builddir
meson test --verbose --no-rebuild -C builddir
- name: Update flopy
working-directory: modflow6/autotest
run: python update_flopy.py

- name: Get executables
working-directory: modflow6/autotest
env:
GITHUB_TOKEN: ${{ github.token }}
run: pytest -v --durations 0 get_exes.py

- name: Test programs
working-directory: modflow6/autotest
run: |
if [ "${{ github.ref_name }}" == "master" ]; then
pytest -v -n auto --durations 0 -m "not slow and not regression and not developmode"
else
pytest -v -n auto --durations 0 -S
fi
test_gfortran_latest:
name: Test (gfortran 12)
needs:
- lint
- build
- smoke_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -131,6 +186,8 @@ jobs:

- name: Test programs
working-directory: modflow6/autotest
env:
REPOS_PATH: ${{ github.workspace }}
run: |
if [ "${{ github.ref_name }}" == "master" ]; then
pytest -v -n auto --durations 0 -m "not large and not developmode"
Expand All @@ -149,6 +206,7 @@ jobs:
needs:
- lint
- build
- smoke_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -205,6 +263,8 @@ jobs:

- name: Test modflow6
working-directory: modflow6/autotest
env:
REPOS_PATH: ${{ github.workspace }}
run: |
if [ "${{ github.ref_name }}" == "master" ]; then
pytest -v -n auto --durations 0 -m "not large and not developmode"
Expand All @@ -217,6 +277,7 @@ jobs:
needs:
- lint
- build
- smoke_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -299,6 +360,8 @@ jobs:
- name: Test programs
if: runner.os != 'Windows'
working-directory: modflow6/autotest
env:
REPOS_PATH: ${{ github.workspace }}
run: |
if [ "${{ github.ref_name }}" == "master" ]; then
pytest -v -n auto --durations 0 -m "not large and not developmode"
Expand All @@ -310,6 +373,8 @@ jobs:
if: runner.os == 'Windows'
working-directory: modflow6/autotest
shell: pwsh
env:
REPOS_PATH: ${{ github.workspace }}
run: |
if ( "${{ github.ref_name }}" -eq "master" ) {
pytest -v -n auto --durations 0 -m "not large and not developmode"
Expand Down
321 changes: 233 additions & 88 deletions DEVELOPER.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This repository contains an `./autotest` folder with python scripts for building

* [modflowpy/pymake](https://github.com/modflowpy/pymake)
* [modflowpy/flopy](https://github.com/modflowpy/flopy)
* [MODFLOW-USGS/modflow6-examples](https://github.com/MODFLOW-USGS/modflow6-examples)
* [MODFLOW-USGS/modflow6-testmodels](https://github.com/MODFLOW-USGS/modflow6-testmodels)
* [MODFLOW-USGS/modflow6-largetestmodels](https://github.com/MODFLOW-USGS/modflow6-largetestmodels)
* [MODFLOW-USGS/executables](https://github.com/MODFLOW-USGS/executables)
Expand Down
202 changes: 0 additions & 202 deletions autotest/binary_file_writer.py

This file was deleted.

Loading

0 comments on commit e51530c

Please sign in to comment.