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
5 changes: 3 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import shutil
import importlib

import nox

Expand Down Expand Up @@ -89,21 +88,25 @@ 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:
os.makedirs('reports', exist_ok=True)

command = [
'pytest',
'--cov=src/ampworks',
'--cov=ampworks',
'--cov-report=html:reports/htmlcov',
'--cov-report=xml:reports/coverage.xml',
'--junitxml=reports/junit.xml',
Expand Down