~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-05-24 16:57:38 UTC
  • mfrom: (2492.1.2 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070524165738-rzs9lvgoqk20vls9
(Marien Zwart) Update test_selftest.test_elapsed_time_with... to be more forgiving

Show diffs side-by-side

added added

removed removed

Lines of Context:
620
620
        result.extractBenchmarkTime(self)
621
621
        timed_string = result._testTimeString()
622
622
        # without explicit benchmarking, we should get a simple time.
623
 
        self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms$")
 
623
        self.assertContainsRe(timed_string, "^ +[0-9]+ms$")
624
624
        # if a benchmark time is given, we want a x of y style result.
625
625
        self.time(time.sleep, 0.001)
626
626
        result.extractBenchmarkTime(self)
627
627
        timed_string = result._testTimeString()
628
 
        self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms/ *[ 1-9][0-9]ms$")
 
628
        self.assertContainsRe(
 
629
            timed_string, "^ +[0-9]+ms/ +[0-9]+ms$")
629
630
        # extracting the time from a non-bzrlib testcase sets to None
630
631
        result._recordTestStartTime()
631
632
        result.extractBenchmarkTime(
632
633
            unittest.FunctionTestCase(self.test_elapsed_time_with_benchmarking))
633
634
        timed_string = result._testTimeString()
634
 
        self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms$")
 
635
        self.assertContainsRe(timed_string, "^ +[0-9]+ms$")
635
636
        # cheat. Yes, wash thy mouth out with soap.
636
637
        self._benchtime = None
637
638