From 2dcdf88b10d56e9c6bf4dc83aed8be0401d8cb3a Mon Sep 17 00:00:00 2001 From: Peter Corke Date: Fri, 23 Oct 2026 17:36:02 +1000 Subject: [PATCH] ci: measure coverage of the installed package, so Codecov gets real data The coverage job installs the package and runs the tests against the installed copy, but told coverage to measure src/roboticstoolbox, which never runs: "No data was collected", an empty report, and Codecov showing 0% on every commit of main, with 16686 lines and no hits. Coverage now measures the package by name, [tool.coverage.paths] maps the installed files back to src/, and relative_files makes the report use the paths of the repository, so that Codecov can match them. Left out of the report: the Dynamixel and ROS sketches, the two DHFactor modules that nothing imports, and bin/, which the tests run in a subprocess that coverage does not trace. .github/codecov.yml: no comment on each pull request, and the project and patch statuses are informational. Only "All tests passed" is a required check. Co-Authored-By: Claude Sonnet 5.5 --- .github/codecov.yml | 12 ++++++++++++ .github/workflows/ci.yml | 2 +- pyproject.toml | 23 ++++++++++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..f836078a5 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,12 @@ +# Codecov reports coverage, and does not comment or fail a pull request. Only +# "All tests passed" and the PR title are required checks (see CONTRIBUTING.md). +comment: false + +coverage: + status: + project: + default: + informational: true + patch: + default: + informational: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c6dc8137..611a1a4e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,7 +168,7 @@ jobs: key: robot-descriptions-v2-${{ runner.os }}-3.12 - name: Run coverage - run: pytest tests/ --ignore=tests/test_blocks.py --cov=src/roboticstoolbox --cov-report=xml:coverage.xml -q + run: pytest tests/ --ignore=tests/test_blocks.py --cov=roboticstoolbox --cov-report=xml:coverage.xml -q - uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: diff --git a/pyproject.toml b/pyproject.toml index f3d4d80ad..afeaab36f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -379,5 +379,26 @@ module = [ ] ignore_errors = true +# CI installs the package and runs the tests against the installed copy, so coverage +# measures it by name. [tool.coverage.paths] maps the installed files back to src/, +# so that the report, and Codecov, use the paths of the repository. [tool.coverage.run] -omit = ["src/roboticstoolbox/demo/*", "test_*.py"] +source = ["roboticstoolbox"] +relative_files = true +omit = ["src/roboticstoolbox/demo/*", "*/roboticstoolbox/demo/*", "test_*.py"] + +[tool.coverage.paths] +source = ["src/roboticstoolbox", "*/site-packages/roboticstoolbox"] + +# Left out of the report, since they have no tests or cannot be measured +[tool.coverage.report] +omit = [ + # sketches for hardware, with no tests, that nobody maintains + "*/roboticstoolbox/backends/Dynamixel/*", + "*/roboticstoolbox/backends/ROS/*", + # the unfinished port of DHFactor, which nothing imports + "*/roboticstoolbox/robot/DHFactor.py", + "*/roboticstoolbox/tools/DHFactor.py", + # the command-line tools run in a subprocess in the tests, which coverage does not trace + "*/roboticstoolbox/bin/*", +]