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.
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/\*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With