From 4732b26c930057a56bebf90032b540402dbb609f Mon Sep 17 00:00:00 2001 From: David Szotten Date: Wed, 21 Sep 2016 08:44:39 +0000 Subject: [PATCH] test for calling set_trace with custom pdb cls --- testing/test_pdb.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 15cb40eb696..f164f9691b8 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -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()