I wanted to test out how well subprocess coverage works for WSGI apps and I came across a strange behavior. After running the tests a few times I deliberately commented out a test to see if the coverage dropped - it didn't.
I experimented with that a bit and it turns out, that the loss of coverage will be detected if I run "coverage erase" twice before running the tests. It also seems that it works when I run "erase" from shell and then run my "run_coverage" script with "coverage erase" lines removed. Adding "sleep" in "run_coverage" before a single "coverage erase" doesn't work.
- clone https://github.com/butla/experiments
- checkout commit ID c4d441de7c
- go to subprocess_coverage dir
- create a Python 3.4 virtualenv and install requirements.txt (I have coverage_pth there)
- delete one of "coverage erase" lines in "run_coverage.sh"
- run "run_coverage.sh"
- comment out one of the tests in tests/test_wsgi_app.py
- run "run_coverage.sh" again - coverage still at 100%