Skip to content

Commit

Permalink
test for calling set_trace with custom pdb cls
Browse files Browse the repository at this point in the history
  • Loading branch information
davidszotten committed Sep 21, 2016
1 parent 3339921 commit 4732b26
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions testing/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,22 @@ def test_pdb_custom_cls_without_pdb(self, testdir, custom_pdb_calls):
"*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()

0 comments on commit 4732b26

Please sign in to comment.