diff options
author | Aleksandr <ivansduck@gmail.com> | 2022-06-30 12:19:19 +0300 |
---|---|---|
committer | Aleksandr <ivansduck@gmail.com> | 2022-06-30 12:19:19 +0300 |
commit | 0cdef19ada09af464000d084786d3a8a7927e839 (patch) | |
tree | eb79d46a474631eeb4e7981a64de73a77c925b9b | |
parent | fd7cbab1745211b326c9e51338a5a98db935c4ab (diff) | |
download | ydb-0cdef19ada09af464000d084786d3a8a7927e839.tar.gz |
DEVTOOLS-7854 [devtools/ya/test] Dump python traceback in case of timeout for import_tests
ref:27d3e422ea1b49c6ca8672fe75f7404214043550
-rw-r--r-- | library/python/testing/import_test/import_test.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/library/python/testing/import_test/import_test.py b/library/python/testing/import_test/import_test.py index 3e3b7234ef..5290ae3cae 100644 --- a/library/python/testing/import_test/import_test.py +++ b/library/python/testing/import_test/import_test.py @@ -4,6 +4,7 @@ import os import re import sys import time +import signal import traceback import __res @@ -100,6 +101,18 @@ test_imports = check_imports def main(): skip_names = sys.argv[1:] + try: + import faulthandler + except ImportError: + faulthandler = None + + if faulthandler: + # Dump python backtrace in case of any errors + faulthandler.enable() + if hasattr(signal, "SIGUSR2"): + # SIGUSR2 is used by test_tool to teardown tests + faulthandler.register(signal.SIGUSR2, chain=True) + os.environ['Y_PYTHON_IMPORT_TEST'] = '' # We should initialize Django before importing any applications |