diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 09bc9a9..89bb5ec 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -35,10 +35,11 @@ jobs: - name: Install ampworks run: | python -m pip install --upgrade pip + python -m pip install --upgrade nox pip install .[tests] - - name: Pytest with coverage - run: pytest --cov=ampworks --cov-report=xml tests/ + - name: Collect coverage + run: nox -s tests -- codecov - name: Upload to codecov uses: codecov/codecov-action@v5 diff --git a/noxfile.py b/noxfile.py index 5143ca5..67ac821 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,6 +1,5 @@ import os import shutil -import importlib import nox @@ -89,13 +88,17 @@ def run_pytest(session: nox.Session) -> None: you can specify the number of workers using an int, e.g., parallel=4. """ - package = importlib.util.find_spec('ampworks') - coverage_folder = os.path.dirname(package.origin) - if 'no-reports' in session.posargs: command = [ 'pytest', - f'--cov={coverage_folder}', # for editable or site-packages + '--cov=ampworks', + 'tests/', + ] + elif 'codecov' in session.posargs: + command = [ + 'pytest', + '--cov=ampworks', + '--cov-report=xml', 'tests/', ] else: @@ -103,7 +106,7 @@ def run_pytest(session: nox.Session) -> None: command = [ 'pytest', - '--cov=src/ampworks', + '--cov=ampworks', '--cov-report=html:reports/htmlcov', '--cov-report=xml:reports/coverage.xml', '--junitxml=reports/junit.xml',