From 28486d3a1f2416c341e800dabc343b596905cca0 Mon Sep 17 00:00:00 2001 From: Dani Rogmans Date: Tue, 23 Dec 2025 11:31:46 +0200 Subject: [PATCH] Try to get proper coverage percent --- .github/workflows/unittests.yaml | 5 +++-- sitecustomize.py | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 sitecustomize.py diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml index 9c49c2b..fee30d0 100644 --- a/.github/workflows/unittests.yaml +++ b/.github/workflows/unittests.yaml @@ -76,11 +76,12 @@ jobs: if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10' working-directory: ${{ inputs.tools_ref != '' && 'tools' || '' }} env: - COVERAGE_PROCESS_START: .coveragerc + COVERAGE_PROCESS_START: ${{ github.workspace }}/${{ inputs.tools_ref != '' && 'tools/' || '' }}.coveragerc + PYTHONPATH: ${{ github.workspace }}/${{ inputs.tools_ref != '' && 'tools' || '' }} run: | coverage erase coverage run -m pytest tests/test_unittests.py --download-weights --delete-weights-now -s -v --junit-xml pytest.xml - coverage combine + coverage combine --keep coverage xml -o coverage.xml - name: Run tests [Windows, macOS] diff --git a/sitecustomize.py b/sitecustomize.py new file mode 100644 index 0000000..69ec3f8 --- /dev/null +++ b/sitecustomize.py @@ -0,0 +1,7 @@ +import os + +# Enable coverage tracking in subprocesses +if os.environ.get("COVERAGE_PROCESS_START"): + import coverage + + coverage.process_startup()