diff options
| author | Aleksandr <[email protected]> | 2022-06-30 12:19:19 +0300 | 
|---|---|---|
| committer | Aleksandr <[email protected]> | 2022-06-30 12:19:19 +0300 | 
| commit | 0cdef19ada09af464000d084786d3a8a7927e839 (patch) | |
| tree | eb79d46a474631eeb4e7981a64de73a77c925b9b /library/python/testing | |
| parent | fd7cbab1745211b326c9e51338a5a98db935c4ab (diff) | |
DEVTOOLS-7854 [devtools/ya/test] Dump python traceback in case of timeout for import_tests
ref:27d3e422ea1b49c6ca8672fe75f7404214043550
Diffstat (limited to 'library/python/testing')
| -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 3e3b7234ef1..5290ae3cae5 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  | 
