Whitelist pydevd debug threads
When debugging a test case with pydevd (e.g. used by PyCharm) it
injects additional threads. These also need to be
whitelisted. Otherwise shutdown will raise an exception in any case.
Change-Id: I8c5146b7f23b1e74524c2e9327fe7c40d238f2af
diff --git a/tests/base.py b/tests/base.py
index 2c3f7bb..ae7233e 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -1664,10 +1664,17 @@
self.fake_nodepool.stop()
self.zk.disconnect()
self.printHistory()
- # we whitelist watchdog threads as they have relatively long delays
+ # We whitelist watchdog threads as they have relatively long delays
# before noticing they should exit, but they should exit on their own.
+ # Further the pydevd threads also need to be whitelisted so debugging
+ # e.g. in PyCharm is possible without breaking shutdown.
+ whitelist = ['executor-watchdog',
+ 'pydevd.CommandThread',
+ 'pydevd.Reader',
+ 'pydevd.Writer',
+ ]
threads = [t for t in threading.enumerate()
- if t.name != 'executor-watchdog']
+ if t.name not in whitelist]
if len(threads) > 1:
log_str = ""
for thread_id, stack_frame in sys._current_frames().items():