From 651dd06b7ae722d25f3295a905c05a76809417a0 Mon Sep 17 00:00:00 2001 From: John Chilton <jmchilton@gmail.com> Date: Tue, 7 Apr 2015 22:17:33 -0400 Subject: [PATCH] Add thread debugging function to test_utils. (In case I need it in the future again.) --- test/test_utils.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test_utils.py b/test/test_utils.py index c234361f..745e80b0 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1,3 +1,9 @@ +from __future__ import print_function + +import traceback +import sys +import threading + from contextlib import contextmanager from stat import S_IXOTH from os import pardir, stat, chmod, access, X_OK, pathsep, environ @@ -408,3 +414,15 @@ def files_server(directory=None): app = TestApp(JobFilesApp(directory)) with server_for_test_app(app) as server: yield server + + +def dump_other_threads(): + # Utility for debugging threads that aren't dying during + # tests. + main_thread = threading.current_thread() + for t in threading.enumerate(): + if t is main_thread: + continue + + print(t.getName()) + traceback.print_stack(sys._current_frames()[t.ident]) -- GitLab