문제

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/\*
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top