To reproduce: in current pypy (r74497), add a new AppTest:
You may have to run the test twice to get the problem.
This triggers three bugs in various places:
pypy uses ##file## to create traceback entries, which may end in '.pyc' (the normal way is to use co_filename, which is always a '.py')
then py.test attempts to get the source code, but opens the .pyc file, and calls syntax_checker(). This fails of course and leads to a pile of INTERNALERROR lines.
* then pytest_capture is lost: pytest_runtest_makereport failed, suspendcapture() is not called, and the next call to resumecapture() will raise the error
"cannot resume, already capturing with 'no'".
I think all three places should be modified (and it's not only pypy's fault!)