Skip to content

Commit 34bb2d8

Browse files
okkenflub
authored andcommitted
recommended flub changes
1 parent c1c6691 commit 34bb2d8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pytest_timeout.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
__all__ = ("is_debugging", "Settings")
22-
suite_timeout_key = pytest.StashKey[float]()
22+
SUITE_TIMEOUT_KEY = pytest.StashKey[float]()
2323

2424

2525
HAVE_SIGALRM = hasattr(signal, "SIGALRM")
@@ -135,13 +135,9 @@ def pytest_addhooks(pluginmanager):
135135
pluginmanager.add_hookspecs(TimeoutHooks)
136136

137137

138-
_suite_expire_time = 0
139-
140-
141138
@pytest.hookimpl
142139
def pytest_configure(config):
143140
"""Register the marker so it shows up in --markers output."""
144-
global _suite_expire_time, _suite_timeout_minutes
145141
config.addinivalue_line(
146142
"markers",
147143
"timeout(timeout, method=None, func_only=False, "
@@ -168,7 +164,7 @@ def pytest_configure(config):
168164
expire_time = time.time() + timeout
169165
else:
170166
expire_time = 0
171-
config.stash[suite_timeout_key] = expire_time
167+
config.stash[SUITE_TIMEOUT_KEY] = expire_time
172168

173169

174170
@pytest.hookimpl(hookwrapper=True)
@@ -539,7 +535,7 @@ def dump_stacks(terminal):
539535
def pytest_runtest_makereport(item, call):
540536
session = item.session
541537
config = session.config
542-
expire_time = config.stash[suite_timeout_key]
538+
expire_time = config.stash[SUITE_TIMEOUT_KEY]
543539
if expire_time and (expire_time < time.time()):
544540
timeout = config.getoption("--suite-timeout")
545541
session.shouldfail = f"suite-timeout: {timeout} sec exceeded"

0 commit comments

Comments
 (0)