From 9c07132b0ed42caaf351bae70f69337574c16e54 Mon Sep 17 00:00:00 2001 From: "Corey R. Randall" Date: Tue, 10 Feb 2026 09:17:51 -0700 Subject: [PATCH] Simplify codecov workflow with existing nox tests session --- .github/workflows/codecov.yml | 5 +++-- noxfile.py | 15 +++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 3d62b56..3a548bd 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -35,10 +35,11 @@ jobs: - name: Install thevenin run: | python -m pip install --upgrade pip + python -m pip install --upgrade nox pip install .[tests] - - name: Pytest with coverage - run: pytest --cov=thevenin --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 355e5b9..2fd9b67 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('thevenin') - 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=thevenin', + 'tests/', + ] + elif 'codecov' in session.posargs: + command = [ + 'pytest', + '--cov=thevenin', + '--cov-report=xml', 'tests/', ] else: @@ -103,7 +106,7 @@ def run_pytest(session: nox.Session) -> None: command = [ 'pytest', - '--cov=src/thevenin', + '--cov=thevenin', '--cov-report=html:reports/htmlcov', '--cov-report=xml:reports/coverage.xml', '--junitxml=reports/junit.xml',