Rev 6607: (vila) Inline testtools private method to fix an issue in xenial (the in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Dec 17 18:39:00 UTC 2015
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6607 [merge]
revision-id: pqm at pqm.ubuntu.com-20151217183900-0719du2uv1kwu3lc
parent: pqm at pqm.ubuntu.com-20151005134500-v244rho557tv0ukd
parent: jelmer at jelmer.uk-20151108153218-cspx6qzg2uzhbf0f
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2015-12-17 18:39:00 +0000
message:
(vila) Inline testtools private method to fix an issue in xenial (the
private implementation has changed in an backward incompatible way).
(Jelmer Vernooij)
modified:
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2013-08-09 15:09:23 +0000
+++ b/bzrlib/tests/__init__.py 2015-11-08 15:32:18 +0000
@@ -32,6 +32,7 @@
import errno
import itertools
import logging
+import math
import os
import platform
import pprint
@@ -359,10 +360,19 @@
return float(''.join(details['benchtime'].iter_bytes()))
return getattr(testCase, "_benchtime", None)
+ def _delta_to_float(self, a_timedelta, precision):
+ # This calls ceiling to ensure that the most pessimistic view of time
+ # taken is shown (rather than leaving it to the Python %f operator
+ # to decide whether to round/floor/ceiling. This was added when we
+ # had pyp3 test failures that suggest a floor was happening.
+ shift = 10 ** precision
+ return math.ceil((a_timedelta.days * 86400.0 + a_timedelta.seconds +
+ a_timedelta.microseconds / 1000000.0) * shift) / shift
+
def _elapsedTestTimeString(self):
"""Return a time string for the overall time the current test has taken."""
return self._formatTime(self._delta_to_float(
- self._now() - self._start_datetime))
+ self._now() - self._start_datetime, 3))
def _testTimeString(self, testCase):
benchmark_time = self._extractBenchmarkTime(testCase)
More information about the bazaar-commits
mailing list