Open
Description
$ pytest --version
This is pytest version 3.6.2, imported from /private/tmp/x/venv/lib/python3.6/site-packages/pytest.py
# t.py
syntax error
$ pytest t.py --pdb
============================ test session starts =============================
platform darwin -- Python 3.6.5, pytest-3.6.2, py-1.5.4, pluggy-0.6.0
rootdir: /private/tmp/x, inifile:
collecting 0 items
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
venv/lib/python3.6/site-packages/_pytest/python.py:468: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
venv/lib/python3.6/site-packages/py/_path/local.py:668: in pyimport
__import__(modname)
E File "/private/tmp/x/t.py", line 1
E syntax error
E ^
E SyntaxError: invalid syntax
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /private/tmp/x/venv/lib/python3.6/site-packages/_pytest/python.py(471)_importtestmodule()
-> _pytest._code.ExceptionInfo().getrepr(style="short")
(Pdb) list
466 importmode = self.config.getoption("--import-mode")
467 try:
468 mod = self.fspath.pyimport(ensuresyspath=importmode)
469 except SyntaxError:
470 raise self.CollectError(
471 -> _pytest._code.ExceptionInfo().getrepr(style="short")
472 )
473 except self.fspath.ImportMismatchError:
474 e = sys.exc_info()[1]
475 raise self.CollectError(
476 "import file mismatch:\n"
(Pdb) q
collected 0 items / 1 errors
!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!
========================== 1 error in 8.44 seconds ===========================
as far as I can tell, it has always done this -- is this a desirable behaviour?