replace pytest-timeout with SIGABRT hook (#17122)

This commit is contained in:
2026-07-21 17:42:58 -04:00
committed by GitHub
parent f41e4a758f
commit 8fa5993923
2 changed files with 10 additions and 3 deletions
+10
View File
@@ -0,0 +1,10 @@
import os, pytest, signal, threading
@pytest.hookimpl(wrapper=True)
def pytest_runtest_call(item):
t = threading.Timer(int(os.getenv("TEST_TIMEOUT", 300)), os.kill, args=(os.getpid(), signal.SIGABRT))
t.start()
try: yield
finally:
t.cancel()
t.join()
-3
View File
@@ -74,7 +74,6 @@ testing_minimal = [
"torch==2.9.1",
"pytest",
"pytest-xdist",
"pytest-timeout",
"pytest-split",
"hypothesis>=6.148.9",
"z3-solver<4.15.4", # 4.15.4 has a segfault when creating many z3.Context()
@@ -160,8 +159,6 @@ norecursedirs = [
".hypothesis",
".git",
]
timeout = 300
timeout_func_only = true
testpaths = ["test"]
filterwarnings = [
# Ignore SWIG warnings from importlib