Beispiel #1
0
 def testPushPop4(self):
     self.assertEquals(TIMEOUT_NEVER, Timeout.current())
     Tasklet.set_current_timeout(10.0)
     self.assertAlmostEqual(10.0, Timeout.current(), places = 1)
     Timeout.push(TIMEOUT_CURRENT)
     self.assertAlmostEqual(10.0, Timeout.current(), places = 1)
     Timeout.pop()
     self.assertAlmostEqual(10.0, Timeout.current(), places = 1)
     Tasklet.set_current_timeout(TIMEOUT_NEVER)
Beispiel #2
0
 def testPushPop4(self):
     self.assertEquals(TIMEOUT_NEVER, Timeout.current())
     Tasklet.set_current_timeout(10.0)
     self.assertAlmostEqual(10.0, Timeout.current(), places=1)
     Timeout.push(TIMEOUT_CURRENT)
     self.assertAlmostEqual(10.0, Timeout.current(), places=1)
     Timeout.pop()
     self.assertAlmostEqual(10.0, Timeout.current(), places=1)
     Tasklet.set_current_timeout(TIMEOUT_NEVER)
Beispiel #3
0
    def testPushPop(self):

        self.assertEquals(TIMEOUT_NEVER, Timeout.current())

        Timeout.push(30)
        self.assertAlmostEqual(30, Timeout.current(), places=1)
        Timeout.pop()
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
        Timeout.push(30)
        self.assertAlmostEqual(30, Timeout.current(), places=1)
        Tasklet.sleep(1.0)
        self.assertAlmostEqual(29, Timeout.current(), places=1)
        #push a temporary short timeout
        Timeout.push(5)
        self.assertAlmostEqual(5, Timeout.current(), places=1)
        Timeout.pop()
        self.assertAlmostEqual(29, Timeout.current(), places=1)

        #try to push a new longer timeout than the parent timeout
        #this should fail, e.g. it will keep the parent timeout
        Timeout.push(60)
        self.assertAlmostEqual(29, Timeout.current(), places=1)
        Timeout.pop()
        self.assertAlmostEqual(29, Timeout.current(), places=1)
        Timeout.pop()
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
Beispiel #4
0
    def testPushPop(self):

        self.assertEquals(TIMEOUT_NEVER, Timeout.current())

        Timeout.push(30)
        self.assertAlmostEqual(30, Timeout.current(), places = 1)
        Timeout.pop()
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
        Timeout.push(30)
        self.assertAlmostEqual(30, Timeout.current(), places = 1)
        Tasklet.sleep(1.0)
        self.assertAlmostEqual(29, Timeout.current(), places = 1)
        #push a temporary short timeout
        Timeout.push(5)
        self.assertAlmostEqual(5, Timeout.current(), places = 1)
        Timeout.pop()
        self.assertAlmostEqual(29, Timeout.current(), places = 1)

        #try to push a new longer timeout than the parent timeout
        #this should fail, e.g. it will keep the parent timeout
        Timeout.push(60)
        self.assertAlmostEqual(29, Timeout.current(), places = 1)
        Timeout.pop()
        self.assertAlmostEqual(29, Timeout.current(), places = 1)
        Timeout.pop()
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
Beispiel #5
0
    def testPushPop2(self):

        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
        Timeout.push(TIMEOUT_NEVER)
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
        Timeout.pop()
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())

        Timeout.push(10)
        self.assertAlmostEqual(10, Timeout.current(), places=1)
        Timeout.push(5)
        self.assertAlmostEqual(5, Timeout.current(), places=1)
        Timeout.pop()
        self.assertAlmostEqual(10, Timeout.current(), places=1)
        Timeout.pop()
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
Beispiel #6
0
    def testPushPop2(self):

        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
        Timeout.push(TIMEOUT_NEVER)
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
        Timeout.pop()
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())

        Timeout.push(10)
        self.assertAlmostEqual(10, Timeout.current(), places = 1)
        Timeout.push(5)
        self.assertAlmostEqual(5, Timeout.current(), places = 1)
        Timeout.pop()
        self.assertAlmostEqual(10, Timeout.current(), places = 1)
        Timeout.pop()
        self.assertEquals(TIMEOUT_NEVER, Timeout.current())
Beispiel #7
0
 def testPushPop2(self):
     
     self.assertEquals(-1, Timeout.current())
     Timeout.push(-1)
     self.assertEquals(-1, Timeout.current())
     Timeout.pop()
     self.assertEquals(-1, Timeout.current())
     
     Timeout.push(10)
     self.assertAlmostEqual(10, Timeout.current(), places = 1)        
     Timeout.push(5)
     self.assertAlmostEqual(5, Timeout.current(), places = 1)
     Timeout.pop()
     self.assertAlmostEqual(10, Timeout.current(), places = 1)
     Timeout.pop()
     self.assertEquals(-1, Timeout.current())
Beispiel #8
0
    def testPushPop2(self):

        self.assertEquals(-1, Timeout.current())
        Timeout.push(-1)
        self.assertEquals(-1, Timeout.current())
        Timeout.pop()
        self.assertEquals(-1, Timeout.current())

        Timeout.push(10)
        self.assertAlmostEqual(10, Timeout.current(), places=1)
        Timeout.push(5)
        self.assertAlmostEqual(5, Timeout.current(), places=1)
        Timeout.pop()
        self.assertAlmostEqual(10, Timeout.current(), places=1)
        Timeout.pop()
        self.assertEquals(-1, Timeout.current())