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 2121__all__ = ("is_debugging" , "Settings" )
2222SESSION_TIMEOUT_KEY = pytest .StashKey [float ]()
2323SESSION_EXPIRE_KEY = pytest .StashKey [float ]()
24-
24+ PYTEST_FAILURE_MESSAGE = "Timeout (>%ss) from pytest-timeout."
2525
2626HAVE_SIGALRM = hasattr (signal , "SIGALRM" )
2727if HAVE_SIGALRM :
@@ -495,7 +495,7 @@ def timeout_sigalrm(item, settings):
495495 dump_stacks (terminal )
496496 if nthreads > 1 :
497497 terminal .sep ("+" , title = "Timeout" )
498- pytest .fail ("Timeout (>%ss) from pytest-timeout plugin." % settings .timeout )
498+ pytest .fail (PYTEST_FAILURE_MESSAGE % settings .timeout )
499499
500500
501501def timeout_timer (item , settings ):
Original file line number Diff line number Diff line change 55
66import pexpect
77import pytest
8+ from pytest_timeout import PYTEST_FAILURE_MESSAGE
89
10+
11+ MATCH_FAILURE_MESSAGE = f"*Failed: { PYTEST_FAILURE_MESSAGE } *"
912pytest_plugins = "pytester"
1013
1114have_sigalrm = pytest .mark .skipif (
@@ -44,7 +47,7 @@ def test_foo():
4447 """
4548 )
4649 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 " ])
4851
4952
5053def test_thread (pytester ):
@@ -239,7 +242,7 @@ def test_foo():
239242 """
240243 )
241244 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 " ])
243246
244247
245248def test_timeout_mark_timer (pytester ):
You can’t perform that action at this time.
0 commit comments