File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1+ Fix crash when discovery fails while using ``-p no:terminal ``.
Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ def repr_failure(self, excinfo):
329329
330330 # Respect explicit tbstyle option, but default to "short"
331331 # (None._repr_failure_py defaults to "long" without "fulltrace" option).
332- tbstyle = self .config .getoption ("tbstyle" )
332+ tbstyle = self .config .getoption ("tbstyle" , "auto" )
333333 if tbstyle == "auto" :
334334 tbstyle = "short"
335335
Original file line number Diff line number Diff line change 1515from _pytest .config .findpaths import determine_setup
1616from _pytest .config .findpaths import get_common_ancestor
1717from _pytest .config .findpaths import getcfg
18+ from _pytest .main import EXIT_INTERRUPTED
1819from _pytest .main import EXIT_NOTESTSCOLLECTED
1920from _pytest .main import EXIT_OK
2021from _pytest .main import EXIT_TESTSFAILED
@@ -752,10 +753,10 @@ def pytest_addoption(parser):
752753 ** {
753754 "conftest" : conftest_source ,
754755 "subdir/conftest" : conftest_source ,
755- "subdir/test_foo" : """
756+ "subdir/test_foo" : """\
756757 def test_foo(pytestconfig):
757758 assert pytestconfig.getini('foo') == 'subdir'
758- """ ,
759+ """ ,
759760 }
760761 )
761762
@@ -788,6 +789,12 @@ def pytest_internalerror(self, excrepr):
788789 assert "ValueError" in err
789790
790791
792+ def test_no_terminal_discovery_error (testdir ):
793+ testdir .makepyfile ("raise TypeError('oops!')" )
794+ result = testdir .runpytest ("-p" , "no:terminal" , "--collect-only" )
795+ assert result .ret == EXIT_INTERRUPTED
796+
797+
791798def test_load_initial_conftest_last_ordering (testdir , _config_for_test ):
792799 pm = _config_for_test .pluginmanager
793800
You can’t perform that action at this time.
0 commit comments