Ticket #7339: django.diff

File django.diff, 1.7 KB (added by fijal, 7 years ago)
  • tests/regressiontests/dispatch/tests/test_dispatcher.py

    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  
    22from django.dispatch import dispatcher, robust
    33import unittest
    44import copy
     5import gc
    56
    67def x(a):
    78    return a
     
    2122   
    2223    def setUp(self):
    2324        # track the initial state, since it's possible that others have bleed receivers in
     25        gc.collect()
    2426        self.sendersBack = copy.copy(dispatcher.sendersBack)
    2527        self.connections = copy.copy(dispatcher.connections)
    2628        self.senders = copy.copy(dispatcher.senders)
    27    
     29
    2830    def _testIsClean(self):
    2931        """Assert that everything has been cleaned up automatically"""
    3032        self.assertEqual(dispatcher.sendersBack, self.sendersBack)
     
    8688        connect(a.a, signal, b)
    8789        expected = []
    8890        del a
     91        gc.collect()
    8992        result = send('this',b, a=b)
    9093        self.assertEqual(result, expected)
    9194        self.assertEqual(list(getAllReceivers(b,signal)), [])
     
    101104        connect(a, signal, b)
    102105        expected = []
    103106        del a
     107        gc.collect()
    104108        result = send('this',b, a=b)
    105109        self.assertEqual(result, expected)
    106110        self.assertEqual(list(getAllReceivers(b,signal)), [])
     
    123127        del a
    124128        del b
    125129        del result
     130        gc.collect()
    126131        self._testIsClean()
    127132   
    128133    def testRobust(self):
Back to Top