py.test can stop with no output

Create issue
Issue #94 resolved
Amaury Forgeot d'Arc created an issue

To reproduce: in current pypy (r74497), add a new AppTest: {{{ #!python class AppTest: def test_raises(self): raises(ValueError, "x") }}}

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!)

Comments (2)

  1. Holger Krekel repo owner

    fix issue94 make reporting more robust against bogus source code (and internally be more careful when presenting unexpected byte sequences) also make py.code.Source accept a list of lines directly.


  2. Log in to comment