File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 21
21
__all__ = ("is_debugging" , "Settings" )
22
22
SESSION_TIMEOUT_KEY = pytest .StashKey [float ]()
23
23
SESSION_EXPIRE_KEY = pytest .StashKey [float ]()
24
-
24
+ PYTEST_FAILURE_MESSAGE = "Timeout (>%ss) from pytest-timeout."
25
25
26
26
HAVE_SIGALRM = hasattr (signal , "SIGALRM" )
27
27
if HAVE_SIGALRM :
@@ -495,7 +495,7 @@ def timeout_sigalrm(item, settings):
495
495
dump_stacks (terminal )
496
496
if nthreads > 1 :
497
497
terminal .sep ("+" , title = "Timeout" )
498
- pytest .fail ("Timeout (>%ss) from pytest-timeout plugin." % settings .timeout )
498
+ pytest .fail (PYTEST_FAILURE_MESSAGE % settings .timeout )
499
499
500
500
501
501
def timeout_timer (item , settings ):
Original file line number Diff line number Diff line change 5
5
6
6
import pexpect
7
7
import pytest
8
+ from pytest_timeout import PYTEST_FAILURE_MESSAGE
8
9
10
+
11
+ MATCH_FAILURE_MESSAGE = f"*Failed: { PYTEST_FAILURE_MESSAGE } *"
9
12
pytest_plugins = "pytester"
10
13
11
14
have_sigalrm = pytest .mark .skipif (
@@ -44,7 +47,7 @@ def test_foo():
44
47
"""
45
48
)
46
49
result = pytester .runpytest_subprocess ("--timeout=1" )
47
- result .stdout .fnmatch_lines (["*Failed: Timeout (>1.0s) from pytest-timeout plugin.* " ])
50
+ result .stdout .fnmatch_lines ([MATCH_FAILURE_MESSAGE % "1.0 " ])
48
51
49
52
50
53
def test_thread (pytester ):
@@ -239,7 +242,7 @@ def test_foo():
239
242
"""
240
243
)
241
244
result = pytester .runpytest_subprocess ()
242
- result .stdout .fnmatch_lines (["*Failed: Timeout (>1.0s) from pytest-timeout plugin.* " ])
245
+ result .stdout .fnmatch_lines ([MATCH_FAILURE_MESSAGE % "1.0 " ])
243
246
244
247
245
248
def test_timeout_mark_timer (pytester ):
You can’t perform that action at this time.
0 commit comments