585
585
result.extractBenchmarkTime(self)
586
586
timed_string = result._testTimeString()
587
587
# without explicit benchmarking, we should get a simple time.
588
self.assertContainsRe(timed_string, "^ [ 1-9][0-9]ms$")
588
self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms$")
589
589
# if a benchmark time is given, we want a x of y style result.
590
590
self.time(time.sleep, 0.001)
591
591
result.extractBenchmarkTime(self)
592
592
timed_string = result._testTimeString()
593
self.assertContainsRe(timed_string, "^ [ 1-9][0-9]ms/ [ 1-9][0-9]ms$")
593
self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms/ *[ 1-9][0-9]ms$")
594
594
# extracting the time from a non-bzrlib testcase sets to None
595
595
result._recordTestStartTime()
596
596
result.extractBenchmarkTime(
597
597
unittest.FunctionTestCase(self.test_elapsed_time_with_benchmarking))
598
598
timed_string = result._testTimeString()
599
self.assertContainsRe(timed_string, "^ [ 1-9][0-9]ms$")
599
self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms$")
600
600
# cheat. Yes, wash thy mouth out with soap.
601
601
self._benchtime = None