Skip to content

Commit

Permalink
adjust pytest calls in workflows to use coverage to call pytest as mo…
Browse files Browse the repository at this point in the history
…dule, for appropriate data collection. adjust paths to globs in coveragerc
  • Loading branch information
ilaflott committed Jan 13, 2025
1 parent be4af5c commit 1923e6d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create_test_conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
export PATH="/opt/views/view/bin:$PATH"
# run pytest
pytest --junit-xml=pytest_results.xml --config-file=fre/pytest.ini --cov-config=fre/coveragerc --cov-report=xml --cov=fre fre/
coverage run -m pytest --junit-xml=pytest_results.xml --config-file=fre/pytest.ini --cov-config=fre/coveragerc --cov-report=xml --cov=fre fre/
# restore original path and install genbadge to generate coverage badge based on xml
export PATH="$path_save"
Expand Down
9 changes: 9 additions & 0 deletions fre/coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ omit =
fre/list/*
fre/run/*
fre/test/*
fre/tests/*
fre/analysis/tests/*
fre/app/generate_time_averages/tests/*
fre/app/regrid_xy/tests/*
fre/catalog/tests/*
fre/cmor/tests/*
fre/make/tests/*
fre/pp/tests/*
fre/yamltools/tests/*
6 changes: 3 additions & 3 deletions fre/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[pytest]
testpaths =
fre/tests
fre/analysis/tests
fre/app/generate_time_averages/tests
fre/app/regrid_xy/tests
fre/catalog/tests
fre/cmor/tests
fre/make/tests
fre/pp/tests
fre/yamltools/tests
fre/analysis/tests
fre/app/generate_time_averages/tests
fre/app/regrid_xy/tests
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test:
commands:
- pylint --max-line-length 120 --max-args 6 -ry --ignored-modules netCDF4,cmor fre/ || echo "pylint returned non-zero exit code and will kill the workflow. guarding against this now."
# run pytest but ignore any tests that require compilation
- pytest --ignore=fre/make/tests/compilation --config-file=fre/pytest.ini --cov-report term-missing --cov-config=fre/coveragerc --cov=fre fre/
- coverage run -m pytest --ignore=fre/make/tests/compilation --config-file=fre/pytest.ini --cov-report term-missing --cov-config=fre/coveragerc --cov=fre fre/
- fre --help
- fre app --help
- fre catalog --help
Expand Down

0 comments on commit 1923e6d

Please sign in to comment.