|
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*"]) |
| 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*"]) |
| 245 | + result.stdout.fnmatch_lines([MATCH_FAILURE_MESSAGE % "1.0"]) |
243 | 246 |
|
244 | 247 |
|
245 | 248 | def test_timeout_mark_timer(pytester): |
@@ -480,7 +483,7 @@ def test_foo(): |
480 | 483 | result = child.read().decode().lower() |
481 | 484 | if child.isalive(): |
482 | 485 | child.terminate(force=True) |
483 | | - assert "timeout >1.0s" not in result |
| 486 | + assert "timeout (>1.0s)" not in result |
484 | 487 | assert "fail" not in result |
485 | 488 |
|
486 | 489 |
|
@@ -524,7 +527,7 @@ def test_foo(): |
524 | 527 | result = child.read().decode().lower() |
525 | 528 | if child.isalive(): |
526 | 529 | child.terminate(force=True) |
527 | | - assert "timeout >1.0s" in result |
| 530 | + assert "timeout (>1.0s)" in result |
528 | 531 | assert "fail" in result |
529 | 532 |
|
530 | 533 |
|
|
0 commit comments