I have a test of trialcoverage which occasionally fails (maybe 1% of the time or so). The trial test runner's "--until-failure" feature is useful for this. :-) If you untar the attached trialcoverage-0.3.12-r46.tar.bz2 and run "trial --until-failure trialcoverage.test.test_tests.Subprocess.test_clean_start_subp_with_pycs" then you should see a test failure eventually. If instead you run "trial --until-failure trialcoverage.test.test_tests.Subprocess.test_clean_start_subp" then it can run indefinitely without failing. The difference between these two tests is that the one called "_with_pycs" allows CPython (which it is executing in a subprocess) to generate .pyc files, and the other one passes PYTHONDONTWRITEBYTECODE=1 to prevent that. In other words, the generation of .pyc files seems to trigger an irreproducible bug.
If you could have a look at this I would appreciate it. The bug is that the wrong source code is being used to produce a summary. I wonder if coverage.py could internally in itself implement a policy of ignoring .pyc files (icky things are more trouble than they are worth), and if it did if it would eliminate this bug.
Oh, this was with today's tip of coverage.py.