Skip to content

Commit

Permalink
Merge pull request #467 from TBoshoven/fix-no-terminal
Browse files Browse the repository at this point in the history
Fix issues related to running xdist with the terminal plugin disabled
  • Loading branch information
RonnyPfannschmidt committed Sep 13, 2019
2 parents 9f9b707 + ddc52f1 commit 79c14b2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog/467.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix crash issues related to running xdist with the terminal plugin disabled.
7 changes: 2 additions & 5 deletions src/xdist/dsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ def __init__(self, config):
self._max_worker_restart = get_default_max_worker_restart(self.config)
# summary message to print at the end of the session
self._summary_report = None
try:
self.terminal = config.pluginmanager.getplugin("terminalreporter")
except KeyError:
self.terminal = None
else:
self.terminal = config.pluginmanager.getplugin("terminalreporter")
if self.terminal:
self.trdist = TerminalDistReporter(config)
config.pluginmanager.register(self.trdist, "terminaldistreporter")

Expand Down
3 changes: 2 additions & 1 deletion src/xdist/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def pytest_configure(config):
session = DSession(config)
config.pluginmanager.register(session, "dsession")
tr = config.pluginmanager.getplugin("terminalreporter")
tr.showfspath = False
if tr:
tr.showfspath = False
if config.getoption("boxed"):
config.option.forked = True

Expand Down
5 changes: 4 additions & 1 deletion src/xdist/workermanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ def _getrsyncoptions(self):
ignores += self.config.option.rsyncignore
ignores += self.config.getini("rsyncignore")

return {"ignores": ignores, "verbose": self.config.option.verbose}
return {
"ignores": ignores,
"verbose": getattr(self.config.option, "verbose", False),
}

def rsync(self, gateway, source, notify=None, verbose=False, ignores=None):
"""Perform rsync to remote hosts for node."""
Expand Down
16 changes: 16 additions & 0 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,22 @@ def test_this(i):
assert "gw0 C / gw1 C" not in result.stdout.str()


def test_without_terminal_plugin(testdir, request):
"""
No output when terminal plugin is disabled
"""
testdir.makepyfile(
"""
def test_1():
pass
"""
)
result = testdir.runpytest("-p", "no:terminal", "-n2")
assert result.stdout.str() == ""
assert result.stderr.str() == ""
assert result.ret == 0


def test_internal_error_with_maxfail(testdir):
"""
Internal error when using --maxfail option (#62, #65).
Expand Down

0 comments on commit 79c14b2

Please sign in to comment.