test for calling set_trace with custom pdb cls

This commit is contained in:
David Szotten 2016-09-21 08:44:39 +00:00
parent c7b4b8cf6f
commit d75748ef6f
1 changed files with 19 additions and 0 deletions

View File

@ -374,3 +374,22 @@ class TestPDB:
"*1 error*",
])
assert custom_pdb_calls == []
def test_pdb_custom_cls_with_settrace(self, testdir, monkeypatch):
testdir.makepyfile(custom_pdb="""
class CustomPdb:
def set_trace(*args, **kwargs):
print 'custom set_trace>'
""")
p1 = testdir.makepyfile("""
import pytest
def test_foo():
pytest.set_trace()
""")
monkeypatch.setenv('PYTHONPATH', str(testdir.tmpdir))
child = testdir.spawn_pytest("--pdbcls=custom_pdb:CustomPdb %s" % str(p1))
child.expect('custom set_trace>')
if child.isalive():
child.wait()