Skip to content

Commit 3329bbb

Browse files
authored
Merge pull request #389 from nicoddemus/excinfo-fix-384
Fix ExceptionInfo usage for pytest 4.1
2 parents dd63d0b + dd6eac1 commit 3329bbb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

changelog/384.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support for pytest 4.1.

xdist/workermanage.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,11 @@ def process_from_remote(self, eventcall): # noqa too complex
345345
except: # noqa
346346
from _pytest._code import ExceptionInfo
347347

348-
excinfo = ExceptionInfo()
348+
# ExceptionInfo API changed in pytest 4.1
349+
if hasattr(ExceptionInfo, "from_current"):
350+
excinfo = ExceptionInfo.from_current()
351+
else:
352+
excinfo = ExceptionInfo()
349353
print("!" * 20, excinfo)
350354
self.config.notify_exception(excinfo)
351355
self.shutdown()

0 commit comments

Comments
 (0)