mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Timeout all unit tests at 60 seconds(if not running on windows)
We have some random test hangs and this will prevent that by forcing the tests to fail in such cases. Windows does not take part of this because it does not support `signal.SIGABRT`, we would have to use threads. Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
4907eb2a8c
commit
7d6a97e7ba
1 changed files with 15 additions and 0 deletions
|
@ -445,7 +445,22 @@ def pytest_collection_modifyitems(config, items):
|
|||
from_filenames_collection_modifyitems(config, items)
|
||||
|
||||
log.warning("Mofifying collected tests to keep track of fixture usage")
|
||||
|
||||
timeout_marker_tests_paths = (
|
||||
str(TESTS_DIR / "unit"),
|
||||
str(PYTESTS_DIR / "unit"),
|
||||
)
|
||||
for item in items:
|
||||
if (
|
||||
not salt.utils.platform.is_windows()
|
||||
and str(pathlib.Path(item.fspath).resolve()).startswith(
|
||||
timeout_marker_tests_paths
|
||||
)
|
||||
and not item.get_closest_marker("timeout")
|
||||
):
|
||||
# Let's apply the timeout marker on the test, if the marker
|
||||
# is not already applied
|
||||
item.add_marker(pytest.mark.timeout(60))
|
||||
for fixture in item.fixturenames:
|
||||
if fixture not in item._fixtureinfo.name2fixturedefs:
|
||||
continue
|
||||
|
|
Loading…
Add table
Reference in a new issue