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):
329
329
330
330
# Respect explicit tbstyle option, but default to "short"
331
331
# (None._repr_failure_py defaults to "long" without "fulltrace" option).
332
- tbstyle = self .config .getoption ("tbstyle" )
332
+ tbstyle = self .config .getoption ("tbstyle" , "auto" )
333
333
if tbstyle == "auto" :
334
334
tbstyle = "short"
335
335
Original file line number Diff line number Diff line change 15
15
from _pytest .config .findpaths import determine_setup
16
16
from _pytest .config .findpaths import get_common_ancestor
17
17
from _pytest .config .findpaths import getcfg
18
+ from _pytest .main import EXIT_INTERRUPTED
18
19
from _pytest .main import EXIT_NOTESTSCOLLECTED
19
20
from _pytest .main import EXIT_OK
20
21
from _pytest .main import EXIT_TESTSFAILED
@@ -752,10 +753,10 @@ def pytest_addoption(parser):
752
753
** {
753
754
"conftest" : conftest_source ,
754
755
"subdir/conftest" : conftest_source ,
755
- "subdir/test_foo" : """
756
+ "subdir/test_foo" : """\
756
757
def test_foo(pytestconfig):
757
758
assert pytestconfig.getini('foo') == 'subdir'
758
- """ ,
759
+ """ ,
759
760
}
760
761
)
761
762
@@ -788,6 +789,12 @@ def pytest_internalerror(self, excrepr):
788
789
assert "ValueError" in err
789
790
790
791
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
+
791
798
def test_load_initial_conftest_last_ordering (testdir , _config_for_test ):
792
799
pm = _config_for_test .pluginmanager
793
800
You can’t perform that action at this time.
0 commit comments