py.test does not show SyntaxErrors when using --pdb

Issue #128 resolved
Antonio Cuni
created an issue

If the test file contains a SyntaxError, py.test --pdb silently fails without telling anything about the cause:

{{{
$ cat test_syntax_error.py
a =
$ py.test test_syntax_error.py
================================= test session starts ==================================
platform linux2 -- Python 2.6.5 -- pytest-1.4.0a1

/tmp/foo/test_syntax_error.py E
test path 1: test_syntax_error.py

======================================== ERRORS ========================================
_____ ERROR collecting /tmp/foo/test_syntax_error.py _____
/home/antocuni/pypy/misc/py-trunk/py/_plugin/pytest_python.py:216: in _importtestmodule

      mod = self.fspath.pyimport(ensuresyspath=True)

/home/antocuni/pypy/misc/py-trunk/py/_path/local.py:530: in pyimport
mod = import(modname, None, None, ['doc'])
E File "/tmp/foo/test_syntax_error.py", line 1
E a =
E ^
E SyntaxError: invalid syntax
=============================== 1 error in 0.02 seconds ================================
$ py.test test_syntax_error.py --pdb
================================= test session starts ==================================
platform linux2 -- Python 2.6.5 -- pytest-1.4.0a1

/tmp/foo/test_syntax_error.py E
test path 1: test_syntax_error.py

=============================== 1 error in 0.04 seconds ================================
$
}}}

Comments (1)

  1. Log in to comment