summaryrefslogtreecommitdiff
path: root/src/_pytest/unittest.py
diff options
context:
space:
mode:
authorRonny Pfannschmidt <ronny.pfannschmidt@redhat.com>2018-11-22 12:20:14 +0100
committerRonny Pfannschmidt <ronny.pfannschmidt@redhat.com>2018-11-22 21:20:32 +0100
commit88bf01a31e6625edec134fc1d49ec882947fb680 (patch)
treee1e9effaaf02112e4fb42d28010d8b466bb57fa4 /src/_pytest/unittest.py
parent6e85febf2095d33b1e42f5182f3b7a52cb881a8a (diff)
downloadpytest-88bf01a31e6625edec134fc1d49ec882947fb680.tar.gz
fix #4386 - restructure construction and partial state of ExceptionInfo
Diffstat (limited to 'src/_pytest/unittest.py')
-rw-r--r--src/_pytest/unittest.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py
index a38a60d8e..d9881cd87 100644
--- a/src/_pytest/unittest.py
+++ b/src/_pytest/unittest.py
@@ -115,6 +115,10 @@ class TestCaseFunction(Function):
rawexcinfo = getattr(rawexcinfo, "_rawexcinfo", rawexcinfo)
try:
excinfo = _pytest._code.ExceptionInfo(rawexcinfo)
+ # invoke the attributes to trigger storing the traceback
+ # trial causes some issue there
+ excinfo.value
+ excinfo.traceback
except TypeError:
try:
try:
@@ -136,7 +140,7 @@ class TestCaseFunction(Function):
except KeyboardInterrupt:
raise
except fail.Exception:
- excinfo = _pytest._code.ExceptionInfo()
+ excinfo = _pytest._code.ExceptionInfo.from_current()
self.__dict__.setdefault("_excinfo", []).append(excinfo)
def addError(self, testcase, rawexcinfo):