Пример #1
0
    def test_stopall(self):
        stoppablemanager = StoppableManager.getinstance()
        stoppablemanager._reset()
        s1 = _StoppableTestObject()
        s2 = _StoppableTestObject()
        self.assertFalse(s1.callback.delivered)
        self.assertFalse(s2.callback.delivered)
        stoppablemanager._removestoppable(s2)
        StoppableManager.stopall()
        self.assertTrue(s1.callback.delivered)
        self.assertFalse(s2.callback.delivered)

        stoppablemanager._stopall()
Пример #2
0
    def test_stopall(self):
        stoppablemanager = StoppableManager.getinstance()
        stoppablemanager._reset()
        s1 = _StoppableTestObject()
        s2 = _StoppableTestObject()
        self.assertFalse(s1.callback.delivered)
        self.assertFalse(s2.callback.delivered)
        stoppablemanager._removestoppable(s2)
        StoppableManager.stopall()
        self.assertTrue(s1.callback.delivered)
        self.assertFalse(s2.callback.delivered)

        stoppablemanager._stopall()
Пример #3
0
 def test_stale_weakref(self):
     stoppablemanager = StoppableManager.getinstance()
     stoppablemanager._reset()
     s1 = _StoppableTestObject()
     s2 = _NotInitializedStoppableTestObject()
     ref = weakref.ref(s2)  # no callback
     stoppablemanager._stoppables.append(ref)
     c2 = s2.callback
     self.assertFalse(s1.callback.delivered)
     self.assertFalse(s2.callback.delivered)
     del s2
     s2 = None
     StoppableManager.stopall()
     self.assertTrue(s1.callback.delivered)
     self.assertFalse(c2.delivered)
Пример #4
0
 def test_stale_weakref(self):
     stoppablemanager = StoppableManager.getinstance()
     stoppablemanager._reset()
     s1 = _StoppableTestObject()
     s2 = _NotInitializedStoppableTestObject()
     ref = weakref.ref(s2)  # no callback
     stoppablemanager._stoppables.append(ref)
     c2 = s2.callback
     self.assertFalse(s1.callback.delivered)
     self.assertFalse(s2.callback.delivered)
     del s2
     s2 = None
     StoppableManager.stopall()
     self.assertTrue(s1.callback.delivered)
     self.assertFalse(c2.delivered)
Пример #5
0
 def test_removestoppable_unknown(self):
     stoppablemanager = StoppableManager.getinstance()
     stoppablemanager._reset()
     s1 = _NotStoppableTestObject()
     stoppablemanager._removestoppable(s1)
Пример #6
0
 def test_removestoppable_unknown(self):
     stoppablemanager = StoppableManager.getinstance()
     stoppablemanager._reset()
     s1 = _NotStoppableTestObject()
     stoppablemanager._removestoppable(s1)