diff -r 922db6d3d72c tests/regressiontests/dispatch/tests/test_dispatcher.py
a
|
b
|
from django.dispatch import dispatcher,
|
2 | 2 | from django.dispatch import dispatcher, robust |
3 | 3 | import unittest |
4 | 4 | import copy |
| 5 | import sys |
| 6 | |
| 7 | if sys.platform.startswith('java'): |
| 8 | def garbage_collect(): |
| 9 | """Run the garbage collector and wait a bit to let it do his work""" |
| 10 | import gc, time |
| 11 | gc.collect() |
| 12 | time.sleep(0.1) |
| 13 | else: |
| 14 | def garbage_collect(): |
| 15 | pass |
| 16 | |
5 | 17 | |
6 | 18 | def x(a): |
7 | 19 | return a |
… |
… |
class DispatcherTests(unittest.TestCase)
|
86 | 98 | connect(a.a, signal, b) |
87 | 99 | expected = [] |
88 | 100 | del a |
| 101 | garbage_collect() |
89 | 102 | result = send('this',b, a=b) |
90 | 103 | self.assertEqual(result, expected) |
91 | 104 | self.assertEqual(list(getAllReceivers(b,signal)), []) |
… |
… |
class DispatcherTests(unittest.TestCase)
|
101 | 114 | connect(a, signal, b) |
102 | 115 | expected = [] |
103 | 116 | del a |
| 117 | garbage_collect() |
104 | 118 | result = send('this',b, a=b) |
105 | 119 | self.assertEqual(result, expected) |
106 | 120 | self.assertEqual(list(getAllReceivers(b,signal)), []) |
… |
… |
class DispatcherTests(unittest.TestCase)
|
123 | 137 | del a |
124 | 138 | del b |
125 | 139 | del result |
| 140 | garbage_collect() |
126 | 141 | self._testIsClean() |
127 | 142 | |
128 | 143 | def testRobust(self): |