diff -r d396f72dbee3 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 | import gc |
| | 7 | |
| | 8 | if sys.platform.startswith('java'): |
| | 9 | def garbage_collect(): |
| | 10 | """Run the garbage collector and wait a bit to let it do his work""" |
| | 11 | import time |
| | 12 | gc.collect() |
| | 13 | time.sleep(0.1) |
| | 14 | else: |
| | 15 | def garbage_collect(): |
| | 16 | gc.collect() |
| 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): |