Example #1
0
    def testSimulatedTimeFunctions(self):
        now = reactor.getTime()
        delay = 15
        reactor.sleep(delay)
        self.assertEqual(reactor.getTime(), now+delay)

        reactor.setTime(now)  # put the clock back
        self.assertEqual(reactor.getTime(), now)
Example #2
0
    def testSimulatedTimeFunctions(self):
        now = reactor.getTime()
        delay = 15
        reactor.sleep(delay)
        self.assertEqual(reactor.getTime(), now + delay)

        reactor.setTime(now)  # put the clock back
        self.assertEqual(reactor.getTime(), now)
Example #3
0
 def isSimulated(self):
     """Reactor time is simulated if the clock doesn't go forward"""
     now = reactor.getTime()
     time.sleep(0.1)  # Ensure "real time" advances
     return reactor.getTime() == now  # If reactor doesn't, it's simulated
Example #4
0
 def isSimulated(self):
     """Reactor time is simulated if the clock doesn't go forward"""
     now = reactor.getTime()
     time.sleep(0.1)                 # Ensure "real time" advances
     return reactor.getTime()==now   # If reactor doesn't, it's simulated