pytest-cov
pytest-cov copied to clipboard
Crippled mode
Summary
A funny issue in coverage's bugtracker has led me to consider what's the best way to deal with this problem:
- Users running
coverage -m pytest --cov
Assuming that is the cause of all the craziness in that issue there are 3 way going about it:
- pytest-cov raises an error if an "outside coverage" is detected
- pytest-cov emits warning but disables itself if an "outside coverage" is detected
- pytest-cov goes in "crippled mode" and disables xdist support and anything that wouldn't work by just taking the existing Coverage object and not performing any initialization. Basically it would only generate an report (= what the user wanted: https://github.com/nedbat/coveragepy/issues/915#issuecomment-573469825)
Crippled mode would also solve coverage for pytest plugin (instead of setting those env vars you could just run it in crippled mode).
What do you think?
It turns out bug 915 wasn't because of the double-nesting of coverage, but it could still be a good idea to disallow it somehow.