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)
Beispiel #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)
 def setUp(self):
     super(TimerTestCase, self).setUp()
     self.timer = Timer("test_timer")
Beispiel #4
0
def timer(name, delta, dimensions=None):
    timer = get_metric('timer', name, dimensions, Timer())
    timer._update(delta)
Beispiel #5
0
 def setUp(self):
     super(TimerTestCase, self).setUp()
     self.timer = Timer()