summaryrefslogtreecommitdiff
path: root/tests/dispatch
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2014-02-04 20:19:14 +0200
committerFlorian Apolloner <florian@apolloner.eu>2014-02-05 20:57:40 +0100
commitc29d6f767691cceb9964c0d212e01281ac6721d3 (patch)
treea569120d3d85143127ab483c6d8f3e860af6ea03 /tests/dispatch
parentaea9faa146f5ce8bfaf038dfa2f4377e0543c569 (diff)
downloaddjango-c29d6f767691cceb9964c0d212e01281ac6721d3.tar.gz
Fixed #21952 -- signals deadlock due to locking + weakref interaction
Diffstat (limited to 'tests/dispatch')
-rw-r--r--tests/dispatch/tests/test_dispatcher.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/dispatch/tests/test_dispatcher.py b/tests/dispatch/tests/test_dispatcher.py
index 1ab4a69d33..05b375f7d6 100644
--- a/tests/dispatch/tests/test_dispatcher.py
+++ b/tests/dispatch/tests/test_dispatcher.py
@@ -46,11 +46,12 @@ class DispatcherTests(unittest.TestCase):
def _testIsClean(self, signal):
"""Assert that everything has been cleaned up automatically"""
+ # Note that dead weakref cleanup happens as side effect of using
+ # the signal's receivers through the signals API. So, first do a
+ # call to an API method to force cleanup.
+ self.assertFalse(signal.has_listeners())
self.assertEqual(signal.receivers, [])
- # force cleanup just in case
- signal.receivers = []
-
def testExact(self):
a_signal.connect(receiver_1_arg, sender=self)
expected = [(receiver_1_arg, "test")]