Skip to content

Commit 6c3a5b4

Browse files
Michael Petersflub
Michael Peters
authored andcommitted
remove marker support, update description
1 parent 198b792 commit 6c3a5b4

File tree

2 files changed

+4
-58
lines changed

2 files changed

+4
-58
lines changed

pytest_timeout.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
""".strip()
4343
DISABLE_DEBUGGER_DETECTION_DESC = """
4444
When specified, disables debugger detection. breakpoint(), pdb.set_trace(), etc.
45-
will be interrupted.
45+
will be interrupted by the timeout.
4646
""".strip()
4747

4848
# bdb covers pdb, ipdb, and possibly others
@@ -364,16 +364,14 @@ def _parse_marker(marker):
364364
"""
365365
if not marker.args and not marker.kwargs:
366366
raise TypeError("Timeout marker must have at least one argument")
367-
timeout = method = func_only = disable_debugger_detection = NOTSET = object()
367+
timeout = method = func_only = NOTSET = object()
368368
for kw, val in marker.kwargs.items():
369369
if kw == "timeout":
370370
timeout = val
371371
elif kw == "method":
372372
method = val
373373
elif kw == "func_only":
374374
func_only = val
375-
elif kw == "disable_debugger_detection":
376-
disable_debugger_detection = val
377375
else:
378376
raise TypeError("Invalid keyword argument for timeout marker: %s" % kw)
379377
if len(marker.args) >= 1 and timeout is not NOTSET:
@@ -384,23 +382,15 @@ def _parse_marker(marker):
384382
raise TypeError("Multiple values for method argument of timeout marker")
385383
elif len(marker.args) >= 2:
386384
method = marker.args[1]
387-
if len(marker.args) >= 3 and disable_debugger_detection is not NOTSET:
388-
raise TypeError(
389-
"Multiple values for disable_debugger_detection argument of timeout marker"
390-
)
391-
elif len(marker.args) >= 3:
392-
disable_debugger_detection = marker.args[2]
393-
if len(marker.args) > 3:
385+
if len(marker.args) > 2:
394386
raise TypeError("Too many arguments for timeout marker")
395387
if timeout is NOTSET:
396388
timeout = None
397389
if method is NOTSET:
398390
method = None
399391
if func_only is NOTSET:
400392
func_only = None
401-
if disable_debugger_detection is NOTSET:
402-
disable_debugger_detection = None
403-
return Settings(timeout, method, func_only, disable_debugger_detection)
393+
return Settings(timeout, method, func_only, None)
404394

405395

406396
def _validate_timeout(timeout, where):

test_pytest_timeout.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -530,50 +530,6 @@ def test_foo():
530530
assert "fail" in result
531531

532532

533-
@pytest.mark.parametrize(
534-
["debugging_module", "debugging_set_trace"],
535-
[
536-
("pdb", "set_trace()"),
537-
pytest.param(
538-
"ipdb",
539-
"set_trace()",
540-
marks=pytest.mark.xfail(
541-
reason="waiting on https://github.com/pytest-dev/pytest/pull/7207"
542-
" to allow proper testing"
543-
),
544-
),
545-
pytest.param(
546-
"pydevd",
547-
"settrace(port=4678)",
548-
marks=pytest.mark.xfail(reason="in need of way to setup pydevd server"),
549-
),
550-
],
551-
)
552-
@have_spawn
553-
def test_disable_debugger_detection_marker(
554-
testdir, debugging_module, debugging_set_trace
555-
):
556-
p1 = testdir.makepyfile(
557-
"""
558-
import pytest, {debugging_module}
559-
560-
@pytest.mark.timeout(1, disable_debugger_detection=True)
561-
def test_foo():
562-
{debugging_module}.{debugging_set_trace}
563-
""".format(
564-
debugging_module=debugging_module, debugging_set_trace=debugging_set_trace
565-
)
566-
)
567-
child = testdir.spawn_pytest(str(p1))
568-
child.expect("test_foo")
569-
time.sleep(1.2)
570-
result = child.read().decode().lower()
571-
if child.isalive():
572-
child.terminate(force=True)
573-
assert "timeout >1.0s" in result
574-
assert "fail" in result
575-
576-
577533
def test_is_debugging(monkeypatch):
578534
import pytest_timeout
579535

0 commit comments

Comments
 (0)