Skip to content

Commit d75748e

Browse files
committed
test for calling set_trace with custom pdb cls
1 parent c7b4b8c commit d75748e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

testing/test_pdb.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,22 @@ def test_pdb_custom_cls_without_pdb(self, testdir, custom_pdb_calls):
374374
"*1 error*",
375375
])
376376
assert custom_pdb_calls == []
377+
378+
def test_pdb_custom_cls_with_settrace(self, testdir, monkeypatch):
379+
testdir.makepyfile(custom_pdb="""
380+
class CustomPdb:
381+
def set_trace(*args, **kwargs):
382+
print 'custom set_trace>'
383+
""")
384+
p1 = testdir.makepyfile("""
385+
import pytest
386+
387+
def test_foo():
388+
pytest.set_trace()
389+
""")
390+
monkeypatch.setenv('PYTHONPATH', str(testdir.tmpdir))
391+
child = testdir.spawn_pytest("--pdbcls=custom_pdb:CustomPdb %s" % str(p1))
392+
393+
child.expect('custom set_trace>')
394+
if child.isalive():
395+
child.wait()

0 commit comments

Comments
 (0)