move import to top
This commit is contained in:
parent
2a1b1107c5
commit
867344d0d7
|
@ -2,6 +2,7 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
import pdb
|
import pdb
|
||||||
import sys
|
import sys
|
||||||
|
from doctest import UnexpectedException
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
@ -95,17 +96,12 @@ def _enter_pdb(node, excinfo, rep):
|
||||||
|
|
||||||
|
|
||||||
def _postmortem_traceback(excinfo):
|
def _postmortem_traceback(excinfo):
|
||||||
try:
|
if isinstance(excinfo.value, UnexpectedException):
|
||||||
from doctest import UnexpectedException
|
# A doctest.UnexpectedException is not useful for post_mortem.
|
||||||
if isinstance(excinfo.value, UnexpectedException):
|
# Use the underlying exception instead:
|
||||||
# A doctest.UnexpectedException is not useful for post_mortem.
|
return excinfo.value.exc_info[2]
|
||||||
# Use the underlying exception instead:
|
else:
|
||||||
return excinfo.value.exc_info[2]
|
return excinfo._excinfo[2]
|
||||||
except ImportError:
|
|
||||||
# If we fail to import, continue quietly (if we ran out of file descriptors, for example: #1810)
|
|
||||||
pass
|
|
||||||
|
|
||||||
return excinfo._excinfo[2]
|
|
||||||
|
|
||||||
|
|
||||||
def _find_last_non_hidden_frame(stack):
|
def _find_last_non_hidden_frame(stack):
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
If we fail to import doctest.UnexpectedException during postmortem, fail quietly and continue.
|
Move import of doctest.UnexpectedException to top-level.
|
Loading…
Reference in New Issue