Question

I have a setup.py that runs tests via the common test_suite: "tests" setting. What is the best way to generate coverage from here? I figured that by running setup.py via the coverage tool, it would include setup.py in its coverage reports?

I have a load_tests hook in my tests/init.py, which I thought would be a nice place to enable coverage, but even that is too early, since it would start coverage before tests. Then there is the setUpClass function, but that would involve modifying every single test to include another module to start and stop coverage from here. It all seems rather clunky.

No correct solution

OTHER TIPS

This will report coverage just for the module you want, assuming that you have a Python module "my_module" with all your .py files and other modules in it:

coverage run --source=my_module/ setup.py test

Just need to apply the filter at report generation time instead of at run-time like Bullseye does:

coverage run ./setup.py test
coverage html --include=libgsync/\*
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top