From 4388e794ce9fe69c3243d28e923d5c23b381136e Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 23 Jan 2019 12:44:08 +0000 Subject: [PATCH] issue #477: Py2.4: enumerate() may return stopped threads. --- tests/testlib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/testlib.py b/tests/testlib.py index 14d88e5a..40ad3238 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -302,7 +302,8 @@ class TestCase(unittest2.TestCase): counts = {} for thread in threading.enumerate(): name = thread.getName() - assert name in self.ALLOWED_THREADS, \ + # Python 2.4: enumerate() may return stopped threads. + assert (not thread.isAlive()) or name in self.ALLOWED_THREADS, \ 'Found thread %r still running after tests.' % (name,) counts[name] = counts.get(name, 0) + 1