How to create coverage from setup.py

I have setup.py that runs tests through a generic parameter test_suite: "tests". What is the best way to get coverage from here? I realized that by running setup.py through the coverage tool, will it include setup.py in its coverage reports?

I have a load_tests load hook in my / init .py tests , which I thought would be a good place to enable coverage, but even that is too early since it will start coverage before testing. Then there is the setUpClass function, but this will require modification of each individual test to enable another module to start and stop coverage here. All of this seems rather awkward.

+3
source share
2 answers

, , Python "my_module" .py :

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

, , Bullseye:

coverage run ./setup.py test
coverage html --include=libgsync/\*
+1

All Articles