~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Kit Randel
  • Date: 2014-12-15 20:24:42 UTC
  • mto: This revision was merged to the branch mainline in revision 6602.
  • Revision ID: kit.randel@canonical.com-20141215202442-usf2ixhypqg8yh6q
added a note for bug-1400567 to the 2.7b release notes

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import errno
33
33
import itertools
34
34
import logging
35
 
import math
36
35
import os
37
36
import platform
38
37
import pprint
360
359
            return float(''.join(details['benchtime'].iter_bytes()))
361
360
        return getattr(testCase, "_benchtime", None)
362
361
 
363
 
    def _delta_to_float(self, a_timedelta, precision):
364
 
        # This calls ceiling to ensure that the most pessimistic view of time
365
 
        # taken is shown (rather than leaving it to the Python %f operator
366
 
        # to decide whether to round/floor/ceiling. This was added when we
367
 
        # had pyp3 test failures that suggest a floor was happening.
368
 
        shift = 10 ** precision
369
 
        return math.ceil((a_timedelta.days * 86400.0 + a_timedelta.seconds +
370
 
            a_timedelta.microseconds / 1000000.0) * shift) / shift
371
 
 
372
362
    def _elapsedTestTimeString(self):
373
363
        """Return a time string for the overall time the current test has taken."""
374
364
        return self._formatTime(self._delta_to_float(
375
 
            self._now() - self._start_datetime, 3))
 
365
            self._now() - self._start_datetime))
376
366
 
377
367
    def _testTimeString(self, testCase):
378
368
        benchmark_time = self._extractBenchmarkTime(testCase)