From 09cf1e2a8a128acd7ef5dadf9c72bfff533de1b0 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 11 Feb 2008 17:35:17 -0700 Subject: [PATCH] test_dirnode.py: simplejson-1.7.1 incorrectly rounds floats to two decimal places. Don't let this bug flunk the timestamp test. --- src/allmydata/test/test_dirnode.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py index 2dcf3c18..327e8b9e 100644 --- a/src/allmydata/test/test_dirnode.py +++ b/src/allmydata/test/test_dirnode.py @@ -333,8 +333,15 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin): def _start(res): self._start_timestamp = time.time() d.addCallback(_start) + # simplejson-1.7.1 (as shipped on Ubuntu 'gutsy') rounds all + # floats to hundredeths (it uses str(num) instead of repr(num)). + # simplejson-1.7.3 does not have this bug. To prevent this bug + # from causing the test to fail, stall for more than a few + # hundrededths of a second. + d.addCallback(self.stall, 0.1) d.addCallback(lambda res: n.add_file("timestamps", upload.Data("stamp me"))) + d.addCallback(self.stall, 0.1) def _stop(res): self._stop_timestamp = time.time() d.addCallback(_stop) -- 2.45.2