Skip to content

Commit

Permalink
refactor(tests): refactor test framework
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wpbonelli committed Jan 7, 2023
1 parent 29dfdcf commit a70efa1
Show file tree
Hide file tree
Showing 212 changed files with 5,640 additions and 14,139 deletions.
81 changes: 73 additions & 8 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 @@ -155,11 +210,13 @@ 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 developmode"
pytest -v -n auto --durations 0 -m "not large and not developmode"
else
pytest -v -n auto --durations 0
pytest -v -n auto --durations 0 -m "not large"
fi
- name: Test scripts
Expand All @@ -173,6 +230,7 @@ jobs:
needs:
- lint
- build
- smoke_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -229,18 +287,21 @@ 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 developmode"
pytest -v -n auto --durations 0 -m "not large and not developmode"
else
pytest -v -n auto --durations 0
pytest -v -n auto --durations 0 -m "not large"
fi
test_ifort:
name: Test (ifort)
needs:
- lint
- build
- smoke_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -346,22 +407,26 @@ 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 developmode"
pytest -v -n auto --durations 0 -m "not large and not developmode"
else
pytest -v -n auto --durations 0
pytest -v -n auto --durations 0 -m "not large"
fi
- name: Test programs (Windows)
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 developmode"
pytest -v -n auto --durations 0 -m "not large and not developmode"
} else {
pytest -v -n auto --durations 0
pytest -v -n auto --durations 0 -m "not large"
}
- name: Test scripts
Expand Down
Loading

0 comments on commit a70efa1

Please sign in to comment.