Skip to content
Open
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
4 changes: 2 additions & 2 deletions pytest_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def pytest_addoption(parser):
metavar="SECONDS",
help=SESSION_TIMEOUT_DESC,
)
parser.addini("timeout", TIMEOUT_DESC)
parser.addini("timeout", TIMEOUT_DESC, type="float")
parser.addini("timeout_method", METHOD_DESC)
parser.addini("timeout_func_only", FUNC_ONLY_DESC, type="bool", default=False)
parser.addini(
Expand All @@ -102,7 +102,7 @@ def pytest_addoption(parser):
type="bool",
default=False,
)
parser.addini("session_timeout", SESSION_TIMEOUT_DESC)
parser.addini("session_timeout", SESSION_TIMEOUT_DESC, type="float")


class TimeoutHooks:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers =
[options]
py_modules = pytest_timeout
install_requires =
pytest>=8.0.0
pytest>=8.4.0
python_requires = >=3.10

[options.entry_points]
Expand Down
25 changes: 25 additions & 0 deletions test_pytest_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,31 @@ def test_foo():
assert result.ret


@pytest.mark.skipif(
pytest.version_tuple < (9, 0),
reason="native [tool.pytest] table requires pytest 9",
)
def test_pyproject_toml_int_timeout(pytester):
pytester.makepyfile(
"""
import time

def test_foo():
time.sleep(2)
"""
)
pytester.makepyprojecttoml(
"""
[tool.pytest]
timeout = 1
session_timeout = 60
"""
)
result = pytester.runpytest_subprocess()
result.stdout.no_fnmatch_line("INTERNALERROR*")
assert result.ret


def test_ini_timeout_func_only(pytester):
pytester.makepyfile(
"""
Expand Down