Do not print INTERNALERROR with --pdb
This gets printed by the terminal reporter already, and currently results in the same error being displayed twice, e.g. when raising an `Exception` manually from `pytest.debugging.pytest_exception_interact`.
This commit is contained in:
parent
d3d8d53e41
commit
448830e656
|
@ -0,0 +1 @@
|
||||||
|
Fix duplicate printing of internal errors when using ``--pdb``.
|
|
@ -109,9 +109,6 @@ class PdbInvoke(object):
|
||||||
_enter_pdb(node, call.excinfo, report)
|
_enter_pdb(node, call.excinfo, report)
|
||||||
|
|
||||||
def pytest_internalerror(self, excrepr, excinfo):
|
def pytest_internalerror(self, excrepr, excinfo):
|
||||||
for line in str(excrepr).split("\n"):
|
|
||||||
sys.stderr.write("INTERNALERROR> %s\n" % line)
|
|
||||||
sys.stderr.flush()
|
|
||||||
tb = _postmortem_traceback(excinfo)
|
tb = _postmortem_traceback(excinfo)
|
||||||
post_mortem(tb)
|
post_mortem(tb)
|
||||||
|
|
||||||
|
|
|
@ -334,8 +334,12 @@ class TestPDB(object):
|
||||||
)
|
)
|
||||||
p1 = testdir.makepyfile("def test_func(): pass")
|
p1 = testdir.makepyfile("def test_func(): pass")
|
||||||
child = testdir.spawn_pytest("--pdb %s" % p1)
|
child = testdir.spawn_pytest("--pdb %s" % p1)
|
||||||
# child.expect(".*import pytest.*")
|
|
||||||
child.expect("Pdb")
|
child.expect("Pdb")
|
||||||
|
|
||||||
|
# INTERNALERROR is only displayed once via terminal reporter.
|
||||||
|
assert len([x for x in child.before.decode().splitlines()
|
||||||
|
if x.startswith("INTERNALERROR> Traceback")]) == 1
|
||||||
|
|
||||||
child.sendeof()
|
child.sendeof()
|
||||||
self.flush(child)
|
self.flush(child)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue