diff -U3 -r -x .svn /home/fijal/load/django-trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py tests/regressiontests/dispatch/tests/test_dispatcher.py
old
|
new
|
|
2 | 2 | from django.dispatch import dispatcher, robust |
3 | 3 | import unittest |
4 | 4 | import copy |
| 5 | import gc |
5 | 6 | |
6 | 7 | def x(a): |
7 | 8 | return a |
… |
… |
|
21 | 22 | |
22 | 23 | def setUp(self): |
23 | 24 | # track the initial state, since it's possible that others have bleed receivers in |
| 25 | gc.collect() |
24 | 26 | self.sendersBack = copy.copy(dispatcher.sendersBack) |
25 | 27 | self.connections = copy.copy(dispatcher.connections) |
26 | 28 | self.senders = copy.copy(dispatcher.senders) |
27 | | |
| 29 | |
28 | 30 | def _testIsClean(self): |
29 | 31 | """Assert that everything has been cleaned up automatically""" |
30 | 32 | self.assertEqual(dispatcher.sendersBack, self.sendersBack) |
… |
… |
|
86 | 88 | connect(a.a, signal, b) |
87 | 89 | expected = [] |
88 | 90 | del a |
| 91 | gc.collect() |
89 | 92 | result = send('this',b, a=b) |
90 | 93 | self.assertEqual(result, expected) |
91 | 94 | self.assertEqual(list(getAllReceivers(b,signal)), []) |
… |
… |
|
101 | 104 | connect(a, signal, b) |
102 | 105 | expected = [] |
103 | 106 | del a |
| 107 | gc.collect() |
104 | 108 | result = send('this',b, a=b) |
105 | 109 | self.assertEqual(result, expected) |
106 | 110 | self.assertEqual(list(getAllReceivers(b,signal)), []) |
… |
… |
|
123 | 127 | del a |
124 | 128 | del b |
125 | 129 | del result |
| 130 | gc.collect() |
126 | 131 | self._testIsClean() |
127 | 132 | |
128 | 133 | def testRobust(self): |