kind-dusk-88649
03/07/2025, 7:14 PM# .coveragerc
[run]
omit =
project_0/python/*
...
# pants.toml
[coverage-py]
config = ".coveragerc"
install_from_resolve = "tools"
fail_under = 100
The issue occurs when no changes to the tested project that is tested. In this case, since no tests are run, no report is generated and coverage-py fails the coverage check:
23:41:59.73 [INFO] Starting: Building coverage_py.pex
23:42:01.54 [INFO] Completed: Building coverage_py.pex
23:42:01.91 [INFO] Preserving local process execution dir /tmp/pants-sandbox-vS2dyM for Generate Pytest report coverage report.
Error: 1.91 [ERROR] 1 Exception encountered:
Engine traceback:
in `test` goal
ProcessExecutionFailure: Process 'Generate Pytest report coverage report.' failed with exit code 1.
stdout:
No data to report.
A quick solution is to add a new dummy test that always run in the project to force coverage-py to run on that. But we are not really fan of that solution as it is kind of hacky. Maybe someone with more knowledge in pytest knows how to do this?kind-dusk-88649
03/07/2025, 9:17 PMable-school-92027
03/07/2025, 9:22 PM# pants.toml
[coverage-py]
global_report = true
so that all files are included on the final report, even the ones who weren't tested, and:
# .coveragerc
[report]
omit =
*/__init__.py
*/*_test.pyable-school-92027
03/07/2025, 9:22 PMreport instead of run because of https://github.com/pantsbuild/pants/issues/16760kind-dusk-88649
03/07/2025, 10:04 PMpants test :: while the second is pants test path_to_file_not_tested_in_reportable-school-92027
03/07/2025, 10:08 PMfail_under = 100 only when running the tests on your CI?kind-dusk-88649
03/08/2025, 12:28 AM--changed-since=origin/main . The issue occured in CI because no change to the reported files was changed. We will be moving to caching at some point, I just need to prioritize it๐
kind-dusk-88649
03/08/2025, 1:03 AMhappy-kitchen-89482
03/08/2025, 7:46 PMkind-dusk-88649
03/08/2025, 8:31 PM