diff options
author | Daniel Hahler <github@thequod.de> | 2019-04-03 22:25:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-03 22:25:38 +0200 |
commit | e88aa957aed7ee9dc3649e88052f548f5ffd0911 (patch) | |
tree | e9b3897d13f832332a28d5fd477693dcaf45d58c /src/_pytest/debugging.py | |
parent | 1410d3dc9a61001f71b74ea800b203e92a25d689 (diff) | |
parent | adebfd0a847feac0be580c638e39aad1976c497a (diff) | |
download | pytest-e88aa957aed7ee9dc3649e88052f548f5ffd0911.tar.gz |
Merge pull request #4854 from blueyed/pdb-skip
pdb: add option to skip `pdb.set_trace()`
Diffstat (limited to 'src/_pytest/debugging.py')
-rw-r--r-- | src/_pytest/debugging.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/_pytest/debugging.py b/src/_pytest/debugging.py index cb1c964c3..3743d31ff 100644 --- a/src/_pytest/debugging.py +++ b/src/_pytest/debugging.py @@ -59,6 +59,13 @@ def pytest_addoption(parser): action="store_true", help="Immediately break when running each test.", ) + group._addoption( + "--pdb-skip", + "--pdb-ignore-set_trace", + dest="pdb_ignore_set_trace", + action="store_true", + help="Ignore calls to pdb.set_trace().", + ) def pytest_configure(config): @@ -209,6 +216,9 @@ class pytestPDB(object): @classmethod def set_trace(cls, *args, **kwargs): """Invoke debugging via ``Pdb.set_trace``, dropping any IO capturing.""" + if pytestPDB._config: # Might not be available when called directly. + if pytestPDB._config.getoption("pdb_ignore_set_trace"): + return frame = sys._getframe().f_back _pdb = cls._init_pdb(*args, **kwargs) _pdb.set_trace(frame) |