Skip to content

Commit 32a2913

Browse files
committed
Fix issues related to running xdist with the terminal plugin disabled
This fixes an issue where the pytest plugin manager returns None if a plugin is not loaded instead of raising an error. It also makes terminal optional in plugin code.
1 parent 9f9b707 commit 32a2913

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

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

0 commit comments

Comments
 (0)