Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ 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
python: '3.9'
nox_session: tests-3.9

- name: Documentation, Python 3.12, Ubuntu
- name: Documentation, Python 3.11, Ubuntu
os: ubuntu-latest
python: '3.12'
python: '3.11'
nox_session: docs

steps:
Expand All @@ -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
5 changes: 3 additions & 2 deletions mamba_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ channels:
dependencies:
- python
- jupyter
- numpy
- numpy < 2
- scipy
- matplotlib
- mdsplus
Expand All @@ -16,5 +16,6 @@ dependencies:
- sphinx
- pip
- pip:
- pytest
- nox
- pytest
- pytest-cov
33 changes: 31 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,42 @@ def install_environment(session, environment_path="mamba_environment.yml"):
],
silent=False,
)
session.run(
*[
session.venv_backend,
"list",
"--prefix",
session.virtualenv.location,
]
)


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
Loading