Exemplo n.º 1
0
class TimerTestCase(TimedTestCase):
    def setUp(self):
        super(TimerTestCase, self).setUp()
        self.timer = Timer("test_timer")

    def tearDown(self):
        super(TimerTestCase, self).tearDown()

    def test__start_stop_clear(self):
        context = self.timer.time()
        self.clock.add(1)
        context.stop()

        self.assertEqual(self.timer.get_count(), 1)

        self.timer.clear()

        self.assertEqual(self.timer.get_count(), 0)
Exemplo n.º 2
0
class TimerTestCase(TimedTestCase):

    def setUp(self):
        super(TimerTestCase, self).setUp()
        self.timer = Timer()

    def tearDown(self):
        super(TimerTestCase, self).tearDown()

    def test__start_stop_clear(self):
        context = self.timer.time()
        self.clock.add(1)
        context.stop()

        self.assertEqual(self.timer.get_count(), 1)

        self.timer.clear()

        self.assertEqual(self.timer.get_count(), 0)
Exemplo n.º 3
0
 def setUp(self):
     super(TimerTestCase, self).setUp()
     self.timer = Timer("test_timer")
Exemplo n.º 4
0
def timer(name, delta, dimensions=None):
    timer = get_metric('timer', name, dimensions, Timer())
    timer._update(delta)
Exemplo n.º 5
0
 def setUp(self):
     super(TimerTestCase, self).setUp()
     self.timer = Timer()