Merge pull request #389 from nicoddemus/excinfo-fix-384

Fix ExceptionInfo usage for pytest 4.1
This commit is contained in:
Bruno Oliveira
2018-12-11 14:23:21 -02:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -345,7 +345,11 @@ class WorkerController(object):
except: # noqa
from _pytest._code import ExceptionInfo
excinfo = ExceptionInfo()
# ExceptionInfo API changed in pytest 4.1
if hasattr(ExceptionInfo, "from_current"):
excinfo = ExceptionInfo.from_current()
else:
excinfo = ExceptionInfo()
print("!" * 20, excinfo)
self.config.notify_exception(excinfo)
self.shutdown()