From 4fb7a91a5e2c93c0c2fc29af29f22b57782e7bf1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 8 Apr 2019 02:00:28 +0200 Subject: [PATCH] pdb: add test for --trace with --pdbcls Ensures that https://github.com/pytest-dev/pytest/issues/4111 is fixed, which happened in 92a2884b as a byproduct. --- testing/test_pdb.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 77e421af1..cc2ea15d2 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -1148,7 +1148,11 @@ def test_pdbcls_via_local_module(testdir): class Wrapped: class MyPdb: def set_trace(self, *args): - print("mypdb_called", args) + print("settrace_called", args) + + def runcall(self, *args, **kwds): + print("runcall_called", args, kwds) + assert "func" in kwds """, ) result = testdir.runpytest( @@ -1165,4 +1169,11 @@ def test_pdbcls_via_local_module(testdir): str(p1), "--pdbcls=mypdb:Wrapped.MyPdb", syspathinsert=True ) assert result.ret == 0 - result.stdout.fnmatch_lines(["*mypdb_called*", "* 1 passed in *"]) + result.stdout.fnmatch_lines(["*settrace_called*", "* 1 passed in *"]) + + # Ensure that it also works with --trace. + result = testdir.runpytest( + str(p1), "--pdbcls=mypdb:Wrapped.MyPdb", "--trace", syspathinsert=True + ) + assert result.ret == 0 + result.stdout.fnmatch_lines(["*runcall_called*", "* 1 passed in *"])