Exemplo n.º 1
0
 def testExceptsOnJoin(self):
     t = self.newthread(start=True)
     try:
         threadutils.join_timeout(t)
         self.fail("Should have raised a NotImplementedError.")
     except NotImplementedError:
         pass
Exemplo n.º 2
0
 def testExceptedFires(self):
     t = self.newthread()
     t.excepted.connect(self.excCB)
     t.start()
     try:
         threadutils.join_timeout(t)
     except NotImplementedError:
         pass
     self.assertTrue(self.excFired)
     self.assertTrue(t.exc_info)
Exemplo n.º 3
0
 def testResetWorks(self):
     interval = 0.02
     halfinterval = interval / 2
     t = self._startTimer(interval)
     time.sleep(halfinterval)
     t.restart()
     self.assertTrue(t.isAlive())
     threadutils.join_timeout(t)
     # A compare doesn't work- timing issues make it unreliable.
     # Just ensure we have a time diff within some acceptable threshold.
     testhelpers.assertBetween(self, interval, self.timediff, interval * 4)
Exemplo n.º 4
0
 def testResetFailsIfRun(self):
     t = self._startTimer(0.001)
     threadutils.join_timeout(t)
     self.assertRaises(RuntimeError, t.restart)