diff --git a/.github/codecov.yml b/.github/codecov.yml index c61872c..c2ea6d3 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -1,6 +1,6 @@ # Configuration for Codecov: https://docs.codecov.com/docs/codecov-yaml # -# Coverage reports are generated by `nox -s coverage-` and +# Coverage reports are generated by `nox -s dagster_with_coverage` and # uploaded in .github/workflows/ci.yml. coverage: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e14e57..e9b5d88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,15 +55,10 @@ jobs: python: '3.13' nox_session: tests-3.13 - - name: Tests with code coverage, Python 3.12 - os: ubuntu-latest - python: '3.12' - nox_session: coverage-3.12 - - - name: Tests with Dagster + - name: Tests with code coverage and Dagster, Python 3.14 os: ubuntu-latest python: '3.14' - nox_session: dagster + nox_session: dagster_with_coverage - name: Tests, Python 3.11 os: macos-latest @@ -124,7 +119,7 @@ jobs: run: uv run noxfile.py --session '${{ matrix.nox_session }}' - name: Upload coverage reports to Codecov - if: ${{ contains(matrix.nox_session, 'cov') }} + if: ${{ matrix.nox_session == 'dagster_with_coverage' }} uses: codecov/codecov-action@v7.0.0 with: files: ./coverage.xml diff --git a/noxfile.py b/noxfile.py index 1d55213..eff3fda 100644 --- a/noxfile.py +++ b/noxfile.py @@ -66,26 +66,21 @@ def tests(session: nox.Session) -> None: @nox_uv.session(uv_groups=["test", "dagster"], python=MAXPYTHON) -def dagster(session: nox.Session) -> None: +def dagster_with_coverage(session: nox.Session) -> None: """ - Run the tests of logging with Dagster. + Run all tests, including Dagster tests, with code coverage. Dagster has many dependencies, so it is installed only for this - session. The ``tests`` session skips these tests. - """ - session.install(".") - session.run("pytest", "tests/test_logging.py", "-k", "dagster", *session.posargs) - - -@nox_uv.session(uv_groups=["test"], python=SUPPORTED_PYTHON_VERSIONS) -def coverage(session: nox.Session) -> None: - """ - Run tests with pytest and measure code coverage. + session. The ``tests`` session skips the Dagster tests. The project is installed in editable mode (by ``uv sync``) so that file paths in the coverage report point to ``src/``, which is needed for the report uploaded to Codecov to map onto the source. + In CI, reports are uploaded by ``codecov/codecov-action``. To upload + a report locally, set the ``CODECOV_TOKEN`` environment variable and + run ``uvx --from codecov-cli codecovcli upload-process``. + Configuration: ``[tool.coverage]`` in pyproject.toml """ session.run(