Fix ExceptionInfo usage for pytest 4.1

Fix #384
This commit is contained in:
Bruno Oliveira
2018-12-11 12:19:34 -02:00
parent 5ecbf25450
commit dd6eac12a4
2 changed files with 6 additions and 1 deletions

1
changelog/384.bugfix.rst Normal file
View File

@@ -0,0 +1 @@
Add support for pytest 4.1.

View File

@@ -345,6 +345,10 @@ class WorkerController(object):
except: # noqa
from _pytest._code import 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)