Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pytest_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def pytest_addoption(parser):
"--timeout-disable-debugger-detection",
dest="timeout_disable_debugger_detection",
action="store_true",
default=None,
help=DISABLE_DEBUGGER_DETECTION_DESC,
)
group.addoption(
Expand Down
48 changes: 48 additions & 0 deletions test_pytest_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,54 @@ def test_foo():
assert "fail" in result


@pytest.mark.parametrize(
("debugging_module", "debugging_set_trace"),
[
("pdb", "set_trace()"),
pytest.param(
"ipdb",
"set_trace()",
marks=pytest.mark.xfail(
reason="waiting on https://github.com/pytest-dev/pytest/pull/7207"
" to allow proper testing"
),
),
pytest.param(
"pydevd",
"settrace(port=4678)",
marks=pytest.mark.xfail(reason="in need of way to setup pydevd server"),
),
],
)
@have_spawn
def test_disable_debugger_detection_ini(
pytester, debugging_module, debugging_set_trace
):
pytester.makepyfile(
f"""
import pytest, {debugging_module}

@pytest.mark.timeout(1)
def test_foo():
{debugging_module}.{debugging_set_trace}
"""
)
pytester.makeini(
"""
[pytest]
timeout_disable_debugger_detection = true
"""
)
child = pytester.spawn_pytest(str(pytester.path))
child.expect("test_foo")
time.sleep(1.2)
result = child.read().decode().lower()
if child.isalive():
child.terminate(force=True)
assert "timeout (>1.0s)" in result
assert "fail" in result


def test_is_debugging(monkeypatch):
import pytest_timeout

Expand Down