예제 #1
0
 def test_timer_get_non_existent(self, name):
     if name == self.default_timer:
         condition = does_not_raise()
     else:
         condition = pytest.raises(IndexError)
     with condition:
         logger.get_timer(name)
예제 #2
0
 def test_timer_get_run_time_stopped(self, name):
     logger.start_timer(name)
     time.sleep(0.01)
     logger.stop_timer(name)
     timer = logger.get_timer(name)
     time.sleep(0.05)
     assert timer.stop_time - timer.start_time >= 0.01
     assert timer.stop_time - timer.start_time < 0.05
예제 #3
0
 def test_timer_get_added(self, name):
     if name != self.default_timer:
         timer = logger.Timer()
         logger.add_timer(name, timer)
     else:
         timer = logger._timers[name]
     result = logger.get_timer(name)
     assert result == timer
예제 #4
0
 def test_timer_get_run_time_running(self, name):
     logger.start_timer(name)
     time.sleep(0.01)
     timer = logger.get_timer(name)
     assert time.perf_counter() - timer.start_time >= 0.01
예제 #5
0
 def test_timer_get_stop_time(self, name):
     logger.start_timer(name)
     time.sleep(0.01)
     logger.stop_timer(name)
     timer = logger.get_timer(name)
     assert timer.stop_time <= time.perf_counter()
예제 #6
0
 def test_timer_get_created_return_type(self, name):
     if name != self.default_timer:
         logger.add_timer(name)
     timer = logger.get_timer(name)
     assert isinstance(timer, logger.Timer)
예제 #7
0
 def test_timer_get_created(self, name):
     if name != self.default_timer:
         logger.add_timer(name)
     timer = logger.get_timer(name)
     assert timer is not None
예제 #8
0
 def test_timer_get_defaults_return_type(self, name):
     timer = logger.get_timer(name)
     assert isinstance(timer, logger.Timer)
예제 #9
0
 def test_timer_get_defaults(self, name):
     timer = logger.get_timer(name)
     assert timer is not None