Skip to content

Commit 79c14b2

Browse files
Merge pull request #467 from TBoshoven/fix-no-terminal
Fix issues related to running xdist with the terminal plugin disabled
2 parents 9f9b707 + ddc52f1 commit 79c14b2

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

changelog/467.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix crash issues related to running xdist with the terminal plugin disabled.

src/xdist/dsession.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,8 @@ def __init__(self, config):
4949
self._max_worker_restart = get_default_max_worker_restart(self.config)
5050
# summary message to print at the end of the session
5151
self._summary_report = None
52-
try:
53-
self.terminal = config.pluginmanager.getplugin("terminalreporter")
54-
except KeyError:
55-
self.terminal = None
56-
else:
52+
self.terminal = config.pluginmanager.getplugin("terminalreporter")
53+
if self.terminal:
5754
self.trdist = TerminalDistReporter(config)
5855
config.pluginmanager.register(self.trdist, "terminaldistreporter")
5956

src/xdist/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def pytest_configure(config):
170170
session = DSession(config)
171171
config.pluginmanager.register(session, "dsession")
172172
tr = config.pluginmanager.getplugin("terminalreporter")
173-
tr.showfspath = False
173+
if tr:
174+
tr.showfspath = False
174175
if config.getoption("boxed"):
175176
config.option.forked = True
176177

src/xdist/workermanage.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def _getrsyncoptions(self):
112112
ignores += self.config.option.rsyncignore
113113
ignores += self.config.getini("rsyncignore")
114114

115-
return {"ignores": ignores, "verbose": self.config.option.verbose}
115+
return {
116+
"ignores": ignores,
117+
"verbose": getattr(self.config.option, "verbose", False),
118+
}
116119

117120
def rsync(self, gateway, source, notify=None, verbose=False, ignores=None):
118121
"""Perform rsync to remote hosts for node."""

testing/acceptance_test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,22 @@ def test_this(i):
10741074
assert "gw0 C / gw1 C" not in result.stdout.str()
10751075

10761076

1077+
def test_without_terminal_plugin(testdir, request):
1078+
"""
1079+
No output when terminal plugin is disabled
1080+
"""
1081+
testdir.makepyfile(
1082+
"""
1083+
def test_1():
1084+
pass
1085+
"""
1086+
)
1087+
result = testdir.runpytest("-p", "no:terminal", "-n2")
1088+
assert result.stdout.str() == ""
1089+
assert result.stderr.str() == ""
1090+
assert result.ret == 0
1091+
1092+
10771093
def test_internal_error_with_maxfail(testdir):
10781094
"""
10791095
Internal error when using --maxfail option (#62, #65).

0 commit comments

Comments
 (0)