Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when discovery fails while using -p no:terminal #5506

Merged
merged 1 commit into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/5505.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix crash when discovery fails while using ``-p no:terminal``.
2 changes: 1 addition & 1 deletion src/_pytest/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def repr_failure(self, excinfo):

# Respect explicit tbstyle option, but default to "short"
# (None._repr_failure_py defaults to "long" without "fulltrace" option).
tbstyle = self.config.getoption("tbstyle")
tbstyle = self.config.getoption("tbstyle", "auto")
if tbstyle == "auto":
tbstyle = "short"

Expand Down
10 changes: 8 additions & 2 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,10 @@ def pytest_addoption(parser):
**{
"conftest": conftest_source,
"subdir/conftest": conftest_source,
"subdir/test_foo": """
"subdir/test_foo": """\
def test_foo(pytestconfig):
assert pytestconfig.getini('foo') == 'subdir'
""",
""",
}
)

Expand Down Expand Up @@ -777,6 +777,12 @@ def pytest_internalerror(self, excrepr):
assert "ValueError" in err


def test_no_terminal_discovery_error(testdir):
testdir.makepyfile("raise TypeError('oops!')")
result = testdir.runpytest("-p", "no:terminal", "--collect-only")
assert result.ret == ExitCode.INTERRUPTED


def test_load_initial_conftest_last_ordering(testdir, _config_for_test):
pm = _config_for_test.pluginmanager

Expand Down