summaryrefslogtreecommitdiff
path: root/testing/test_pdb.py
diff options
context:
space:
mode:
authorDaniel Hahler <github@thequod.de>2019-04-03 22:25:38 +0200
committerGitHub <noreply@github.com>2019-04-03 22:25:38 +0200
commite88aa957aed7ee9dc3649e88052f548f5ffd0911 (patch)
treee9b3897d13f832332a28d5fd477693dcaf45d58c /testing/test_pdb.py
parent1410d3dc9a61001f71b74ea800b203e92a25d689 (diff)
parentadebfd0a847feac0be580c638e39aad1976c497a (diff)
downloadpytest-e88aa957aed7ee9dc3649e88052f548f5ffd0911.tar.gz
Merge pull request #4854 from blueyed/pdb-skip
pdb: add option to skip `pdb.set_trace()`
Diffstat (limited to 'testing/test_pdb.py')
-rw-r--r--testing/test_pdb.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/test_pdb.py b/testing/test_pdb.py
index 531846e8e..9ccc56fa9 100644
--- a/testing/test_pdb.py
+++ b/testing/test_pdb.py
@@ -10,6 +10,7 @@ import sys
import _pytest._code
import pytest
from _pytest.debugging import _validate_usepdb_cls
+from _pytest.main import EXIT_NOTESTSCOLLECTED
try:
breakpoint
@@ -1121,3 +1122,16 @@ def test_pdb_suspends_fixture_capturing(testdir, fixture):
assert child.exitstatus == 0
assert "= 1 passed in " in rest
assert "> PDB continue (IO-capturing resumed for fixture %s) >" % (fixture) in rest
+
+
+def test_pdb_skip_option(testdir):
+ p = testdir.makepyfile(
+ """
+ print("before_set_trace")
+ __import__('pdb').set_trace()
+ print("after_set_trace")
+ """
+ )
+ result = testdir.runpytest_inprocess("--pdb-ignore-set_trace", "-s", p)
+ assert result.ret == EXIT_NOTESTSCOLLECTED
+ result.stdout.fnmatch_lines(["*before_set_trace*", "*after_set_trace*"])