Exemplo n.º 1
0
    def test_reentrant_stop_watch_merge(self):
        c = metrics.ReentrantStopWatch("watch2")
        d = metrics.ReentrantStopWatch("watch3")
        with c:
            with c:
                time.sleep(0.0025)

        with d:
            with d:
                time.sleep(0.0001)

        t1 = c._time
        t2 = d._time
        d._merge(c)
        self.assertLess(abs(t1 + t2 - d._time), 0.000001)
Exemplo n.º 2
0
 def test_reentrant_stop_watch(self):
     c = metrics.ReentrantStopWatch("watch1")
     with c:
         with c:
             time.sleep(0.01)
     self.assertGreater(c._time, 0)