Merge pull request #4132 from blueyed/pdb-internal-dupe
Do not print (duplicate) INTERNALERROR with --pdb.
This commit is contained in:
commit
3bfaa8ab84
|
@ -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)
|
||||
|
||||
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)
|
||||
post_mortem(tb)
|
||||
|
||||
|
|
|
@ -334,8 +334,20 @@ class TestPDB(object):
|
|||
)
|
||||
p1 = testdir.makepyfile("def test_func(): pass")
|
||||
child = testdir.spawn_pytest("--pdb %s" % p1)
|
||||
# child.expect(".*import pytest.*")
|
||||
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()
|
||||
self.flush(child)
|
||||
|
||||
|
@ -525,7 +537,7 @@ class TestPDB(object):
|
|||
"""
|
||||
def pytest_enter_pdb(config):
|
||||
assert config.testing_verification == 'configured'
|
||||
print 'enter_pdb_hook'
|
||||
print('enter_pdb_hook')
|
||||
|
||||
def pytest_configure(config):
|
||||
config.testing_verification = 'configured'
|
||||
|
@ -562,7 +574,7 @@ class TestPDB(object):
|
|||
custom_pdb="""
|
||||
class CustomPdb(object):
|
||||
def set_trace(*args, **kwargs):
|
||||
print 'custom set_trace>'
|
||||
print('custom set_trace>')
|
||||
"""
|
||||
)
|
||||
p1 = testdir.makepyfile(
|
||||
|
|
Loading…
Reference in New Issue