19
19
20
20
21
21
__all__ = ("is_debugging" , "Settings" )
22
- SUITE_TIMEOUT_KEY = pytest .StashKey [float ]()
22
+ SESSION_TIMEOUT_KEY = pytest .StashKey [float ]()
23
23
24
24
25
25
HAVE_SIGALRM = hasattr (signal , "SIGALRM" )
45
45
When specified, disables debugger detection. breakpoint(), pdb.set_trace(), etc.
46
46
will be interrupted by the timeout.
47
47
""" .strip ()
48
- SUITE_TIMEOUT_DESC = """
49
- Timeout in seconds for entire suite . Default is None which
48
+ SESSION_TIMEOUT_DESC = """
49
+ Timeout in seconds for entire session . Default is None which
50
50
means no timeout. Timeout is checked between tests, and will not interrupt a test
51
51
in progress.
52
52
""" .strip ()
@@ -87,13 +87,13 @@ def pytest_addoption(parser):
87
87
help = DISABLE_DEBUGGER_DETECTION_DESC ,
88
88
)
89
89
group .addoption (
90
- "--suite -timeout" ,
90
+ "--session -timeout" ,
91
91
action = "store" ,
92
- dest = "suite_timeout " ,
92
+ dest = "session_timeout " ,
93
93
default = None ,
94
94
type = float ,
95
95
metavar = "SECONDS" ,
96
- help = SUITE_TIMEOUT_DESC ,
96
+ help = SESSION_TIMEOUT_DESC ,
97
97
)
98
98
parser .addini ("timeout" , TIMEOUT_DESC )
99
99
parser .addini ("timeout_method" , METHOD_DESC )
@@ -159,12 +159,12 @@ def pytest_configure(config):
159
159
config ._env_timeout_func_only = settings .func_only
160
160
config ._env_timeout_disable_debugger_detection = settings .disable_debugger_detection
161
161
162
- timeout = config .getoption ("--suite -timeout" )
162
+ timeout = config .getoption ("--session -timeout" )
163
163
if timeout is not None :
164
164
expire_time = time .time () + timeout
165
165
else :
166
166
expire_time = 0
167
- config .stash [SUITE_TIMEOUT_KEY ] = expire_time
167
+ config .stash [SESSION_TIMEOUT_KEY ] = expire_time
168
168
169
169
170
170
@pytest .hookimpl (hookwrapper = True )
@@ -184,11 +184,11 @@ def pytest_runtest_protocol(item):
184
184
if is_timeout and settings .func_only is False :
185
185
hooks .pytest_timeout_cancel_timer (item = item )
186
186
187
- # check suite timeout
188
- expire_time = item .session .config .stash [SUITE_TIMEOUT_KEY ]
187
+ # check session timeout
188
+ expire_time = item .session .config .stash [SESSION_TIMEOUT_KEY ]
189
189
if expire_time and (expire_time < time .time ()):
190
- timeout = item .session .config .getoption ("--suite -timeout" )
191
- item .session .shouldfail = f"suite -timeout: { timeout } sec exceeded"
190
+ timeout = item .session .config .getoption ("--session -timeout" )
191
+ item .session .shouldfail = f"session -timeout: { timeout } sec exceeded"
192
192
193
193
194
194
@pytest .hookimpl (hookwrapper = True )
@@ -223,9 +223,9 @@ def pytest_report_header(config):
223
223
)
224
224
)
225
225
226
- suite_timeout = config .getoption ("--suite -timeout" )
227
- if suite_timeout :
228
- timeout_header .append ("suite timeout: %ss" % suite_timeout )
226
+ session_timeout = config .getoption ("--session -timeout" )
227
+ if session_timeout :
228
+ timeout_header .append ("session timeout: %ss" % session_timeout )
229
229
if timeout_header :
230
230
return timeout_header
231
231
0 commit comments