Skip to content

Commit

Permalink
No coverage by default (#499)
Browse files Browse the repository at this point in the history
* No coverage by default

* Pin pandas<v2.1

* Add coverage report generation in main branch CI
  • Loading branch information
brynpickering authored Oct 25, 2023
1 parent a01d4bb commit eb75c2a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/.codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ coverage:
patch: off

comment:
layout: "diff, flags, files"
layout: "diff, flags, files"
11 changes: 11 additions & 0 deletions .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,15 @@ jobs:
run: python -m ipykernel install --user --name calliope

- name: run tests
if: github.ref != 'refs/heads/main'
run: pytest

- name: run tests
if: github.ref == 'refs/heads/main'
run: pytest --cov

- name: upload coverage report to Codecov
if: github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v3
env:
directory: "./reports/coverage/"
10 changes: 8 additions & 2 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,17 @@ jobs:
- name: Install jupyter kernel
run: python -m ipykernel install --user --name calliope

- name: run tests
- name: run tests with coverage
if: matrix.os == 'ubuntu-latest' && matrix.py3version == '11'
run: pytest --cov

- name: run tests without coverage
if: matrix.os != 'ubuntu-latest' || matrix.py3version != '11'
run: pytest

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest' && matrix.py3version == '11'
env:
with:
fail_ci_if_error: true
directory: "./reports/coverage/"
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ minversion = "6.0"
# `--strict-markers` - Raise error on unexpected pytest markers being used (add new markers to `markers` config)
# `-nauto` - parallelise over as many threads as possible (uses pytest-xdist). If debugging (`--pdb`), this will default to one thread.
# `--nbmake --nbmake-kernel=calliope` - test example notebooks using the "calliope" notebook kernel (uses nbmake)
# `--cov --cov-report=xml --cov-config=pyproject.toml` - generate coverage report for tests (uses pytest-cov; call `--no-cov` in CLI to switch off; `--cov-config` include to avoid bug)
addopts = "-rav --dist=loadscope --strict-markers -nauto --nbmake --nbmake-kernel=calliope --cov --cov-report=xml --cov-config=pyproject.toml"
# `--cov-report=xml --cov-config=pyproject.toml` - coverage report config for when running in tests (uses pytest-cov; call `--cov` in CLI to switch coverage on; `--cov-config` include to avoid bug)
addopts = "-rav --dist=loadscope --strict-markers -nauto --nbmake --nbmake-kernel=calliope --cov-report=xml --cov-config=pyproject.toml"
# TODO: add testpath once notebooks are fixed: "doc/_static/notebooks"
testpaths = ["tests"]

Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jsonschema >= 4.17, < 4.19
natsort >= 8, < 9
netcdf4 >= 1.2, < 1.7
numpy >= 1, < 2
pandas >= 2, < 3
pandas >= 2, < 2.1
pyomo >= 6.5, < 7
pyparsing >= 3.0, < 3.1
ruamel.yaml >= 0.17, < 0.18
Expand Down

0 comments on commit eb75c2a

Please sign in to comment.