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.
This commit is contained in:
Tom Boshoven
2019-09-11 19:47:16 -04:00
parent 9f9b707481
commit 32a29138fc
2 changed files with 4 additions and 6 deletions

View File

@@ -49,11 +49,8 @@ class DSession(object):
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")