From: Brian Warner Date: Tue, 12 Feb 2008 00:35:17 +0000 (-0700) Subject: test_dirnode.py: simplejson-1.7.1 incorrectly rounds floats to two decimal places... X-Git-Tag: allmydata-tahoe-0.8.0~97 X-Git-Url: https://git.rkrishnan.org/frontends/FTP-and-SFTP.txt?a=commitdiff_plain;h=09cf1e2a8a128acd7ef5dadf9c72bfff533de1b0;p=tahoe-lafs%2Ftahoe-lafs.git test_dirnode.py: simplejson-1.7.1 incorrectly rounds floats to two decimal places. Don't let this bug flunk the timestamp test. --- 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)