|
10 | 10 | import os
|
11 | 11 | import signal
|
12 | 12 | import sys
|
13 |
| -import time |
14 | 13 | import threading
|
| 14 | +import time |
15 | 15 | import traceback
|
16 | 16 | from collections import namedtuple
|
17 | 17 |
|
|
47 | 47 | """.strip()
|
48 | 48 | SUITE_TIMEOUT_DESC = """
|
49 | 49 | Timeout in seconds for entire suite. Default is None which
|
50 |
| -means no timeout. Timeout is checked between tests, and will not interrupt a test |
51 |
| -in progress. |
| 50 | +means no timeout. Timeout is checked between tests, and will not interrupt a test |
| 51 | +in progress. |
52 | 52 | """.strip()
|
53 | 53 |
|
54 | 54 | # bdb covers pdb, ipdb, and possibly others
|
@@ -205,15 +205,23 @@ def pytest_runtest_call(item):
|
205 | 205 | @pytest.hookimpl(tryfirst=True)
|
206 | 206 | def pytest_report_header(config):
|
207 | 207 | """Add timeout config to pytest header."""
|
| 208 | + timeout_header = [] |
| 209 | + |
208 | 210 | if config._env_timeout:
|
209 |
| - return [ |
| 211 | + timeout_header.append( |
210 | 212 | "timeout: %ss\ntimeout method: %s\ntimeout func_only: %s"
|
211 | 213 | % (
|
212 | 214 | config._env_timeout,
|
213 | 215 | config._env_timeout_method,
|
214 | 216 | config._env_timeout_func_only,
|
215 | 217 | )
|
216 |
| - ] |
| 218 | + ) |
| 219 | + |
| 220 | + suite_timeout = config.getoption("--suite-timeout") |
| 221 | + if suite_timeout: |
| 222 | + timeout_header.append("suite timeout: %ss" % suite_timeout) |
| 223 | + if timeout_header: |
| 224 | + return timeout_header |
217 | 225 |
|
218 | 226 |
|
219 | 227 | @pytest.hookimpl(tryfirst=True)
|
@@ -534,7 +542,7 @@ def dump_stacks(terminal):
|
534 | 542 |
|
535 | 543 | @pytest.hookimpl(tryfirst=True)
|
536 | 544 | def pytest_runtest_makereport(item, call):
|
537 |
| - # only need to check timeout once, at the end, after teardown |
| 545 | + # only need to check timeout once, at the end, after teardown |
538 | 546 | if call.when == "teardown":
|
539 | 547 | session = item.session
|
540 | 548 | config = session.config
|
|
0 commit comments