From 9651f16e8dfa7e8a6ade18f114949ff563fb6917 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 5 Mar 2026 12:31:48 +0100 Subject: [PATCH 1/3] coverage: remove some excludes freebsd coverage is rather a TODO than an exclude. the "unknown platform" exclude has no match in the code. --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d5e018734..c8f6a2c68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -295,8 +295,6 @@ omit = [ [tool.coverage.report] exclude_lines = [ "pragma: no cover", - "pragma: freebsd only", - "pragma: unknown platform only", "def __repr__", "raise AssertionError", "raise NotImplementedError", From 0877b7f48a8153d7cf937c05aec476f480af3c10 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 5 Mar 2026 12:35:43 +0100 Subject: [PATCH 2/3] coverage: remove some omit entries "*/borg/fuse.py" - suspect, let's try what happens if we do not omit. "*/borg/support/*" - directory does not exist anymore. "*/borg/hash_sizes.py" - does not exist anymore. --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c8f6a2c68..6abf83238 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -286,10 +286,7 @@ omit = [ "*/borg/__init__.py", "*/borg/__main__.py", "*/borg/_version.py", - "*/borg/fuse.py", - "*/borg/support/*", "*/borg/testsuite/*", - "*/borg/hash_sizes.py", ] [tool.coverage.report] From 408b6e0513b7bcd36972cf37b581f7663293d2da Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 5 Mar 2026 13:02:20 +0100 Subject: [PATCH 3/3] coverage: misc. tweaks moved --junitxml parameter to the tox configuration. haiku: add coverage params to pytest invocation (tox not used there). vm_tests: add test_results and coverage uploads. hard-code coverage.xml as coverage filename --- .github/workflows/ci.yml | 30 +++++++++++++++++++++++++++--- .gitignore | 2 ++ pyproject.toml | 5 ++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8193de020..01712e9d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -346,7 +346,7 @@ jobs: #sudo -E bash -c "tox -e py" # Ensure locally built binary in ./dist/binary/borg-dir is found during tests export PATH="$GITHUB_WORKSPACE/dist/binary/borg-dir:$PATH" - tox --skip-missing-interpreters -- --junitxml=test-results.xml + tox --skip-missing-interpreters - name: Upload test results to Codecov if: ${{ !cancelled() && !contains(matrix.toxenv, 'mypy') && !contains(matrix.toxenv, 'docs') }} @@ -370,6 +370,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} report_type: coverage env_vars: OS,python + files: coverage.xml vm_tests: permissions: @@ -584,7 +585,7 @@ jobs: pip install -e . # troubles with either tox or pytest xdist, so we run pytest manually: - pytest -v -rs --benchmark-skip -k "not remote and not socket" + pytest -v -n auto -rs --cov=borg --cov-config=pyproject.toml --cov-report=xml --junitxml=test-results.xml --benchmark-skip -k "not remote and not socket" ;; esac @@ -602,6 +603,28 @@ jobs: with: subject-path: 'artifacts/*' + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/codecov-action@v5 + env: + OS: ${{ matrix.os }} + with: + token: ${{ secrets.CODECOV_TOKEN }} + report_type: test_results + env_vars: OS + files: test-results.xml + + - name: Upload coverage to Codecov + if: ${{ !cancelled() }} + uses: codecov/codecov-action@v5 + env: + OS: ${{ matrix.os }} + with: + token: ${{ secrets.CODECOV_TOKEN }} + report_type: coverage + env_vars: OS + files: coverage.xml + windows_tests: if: true # can be used to temporarily disable the build @@ -659,7 +682,7 @@ jobs: export PATH="$GITHUB_WORKSPACE/dist/binary/borg-dir:$PATH" borg.exe -V . env/bin/activate - python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote" --cov=borg --cov-config=pyproject.toml --junitxml=test-results.xml + python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote" --cov=borg --cov-config=pyproject.toml --cov-report=xml --junitxml=test-results.xml - name: Upload test results to Codecov if: ${{ !cancelled() }} @@ -683,3 +706,4 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} report_type: coverage env_vars: OS,python + files: coverage.xml diff --git a/.gitignore b/.gitignore index ea24c4231..ddaadc1a7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,5 +29,7 @@ src/borg/_version.py borg.exe .coverage .coverage.* +coverage.xml +test-results.xml .vagrant diff --git a/pyproject.toml b/pyproject.toml index 6abf83238..34753824f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -175,7 +175,7 @@ env_list = ["py{310,311,312,313,314}-{none,llfuse,pyfuse3,mfusepy}", "docs", "ru [tool.tox.env_run_base] package = "editable-legacy" # without this it does not find setup_docs when running under fakeroot deps = ["-rrequirements.d/development.txt"] -commands = [["python", "-m", "pytest", "-v", "-n", "{env:XDISTN:auto}", "-rs", "--cov=borg", "--cov-config=pyproject.toml", "--benchmark-skip", "--pyargs", "{posargs:borg.testsuite}"]] +commands = [["python", "-m", "pytest", "-v", "-n", "{env:XDISTN:auto}", "-rs", "--cov=borg", "--cov-config=pyproject.toml", "--cov-report=xml", "--junitxml=test-results.xml", "--benchmark-skip", "--pyargs", "{posargs:borg.testsuite}"]] pass_env = ["*"] # fakeroot -u needs some env vars [tool.tox.env_pkg_base] @@ -299,3 +299,6 @@ exclude_lines = [ "if __name__ == .__main__.:", ] ignore_errors = true + +[tool.coverage.xml] +output = "coverage.xml"