Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
python: '3.9'
nox_session: tests-3.9

- name: Tests, Python 3.11, macOS
- name: Tests, Python 3.11, with code coverage, macOS
os: macos-latest
python: '3.11'
nox_session: tests-3.11
nox_session: tests-3.11(cov)

- name: Tests, Python 3.10, macOS
os: macos-latest
Expand Down Expand Up @@ -67,10 +67,12 @@ jobs:
run: python -m pip install --progress-bar off --upgrade nox

- name: Run tests
run: nox -s ${{ matrix.nox_session }}
run: nox -s '${{ matrix.nox_session }}'

- name: Upload coverage to codecov
if: ${{ contains(matrix.nox_session,'cov') }}
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
16 changes: 16 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
codecov:
notify:
wait_for_ci: false
require_ci_to_pass: false
# coverage:
# range: 90..98
# status:
# project:
# default:
# # Temporarily allow a greater project coverage threshold; see #2757
# threshold: 0.9%
# removed_code_behavior: adjust_base
# patch:
# default:
# threshold: 0.5%
# removed_code_behavior: adjust_base
3 changes: 2 additions & 1 deletion mamba_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ dependencies:
- sphinx
- pip
- pip:
- pytest
- nox
- pytest
- pytest-cov
25 changes: 23 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,32 @@ def install_environment(session, environment_path="mamba_environment.yml"):
)


test_specifiers: list = [
nox.param("run all tests", id="all"),
nox.param("with code coverage", id="cov"),
]

with_coverage: tuple[str, ...] = (
"--cov=wipplpy",
"--cov-report=xml",
"--cov-config=pyproject.toml",
"--cov-append",
"--cov-report",
"xml:coverage.xml",
)


@nox.session(python=supported_python_versions)
def tests(session):
@nox.parametrize("test_specifier", test_specifiers)
def tests(session, test_specifier):
"""Run tests with pytest."""
install_environment(session)
session.run("pytest")

options = []
if test_specifier == "with code coverage":
options += with_coverage

session.run("pytest", *options)


@nox.session(python=maxpython)
Expand Down