Merge lp:~jelmer/brz/timestamp-range into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/timestamp-range
Merge into: lp:brz
Diff against target: 12 lines (+1/-1)
1 file modified
breezy/tests/test_timestamp.py (+1/-1)
To merge this branch: bzr merge lp:~jelmer/brz/timestamp-range
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+359158@code.launchpad.net

Commit message

Handle overflow errors from Python 2 as well.

Description of the change

Handle overflow errors from Python 2 as well.

Without this, the test (which uses random inputs) fails with:

ERROR: breezy.tests.test_timestamp.UnpackHighresDateTests.test_random
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Empty attachments:
  log

Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/breezy/tests/test_timestamp.py", line 141, in test_random
    time.gmtime(t)
ValueError: timestamp out of range for platform time_t

----------------------------------------------------------------------
Ran 30616 tests in 460.561s

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/tests/test_timestamp.py'
--- breezy/tests/test_timestamp.py 2018-11-12 01:41:38 +0000
+++ breezy/tests/test_timestamp.py 2018-11-21 22:18:12 +0000
@@ -139,7 +139,7 @@
139 t += random.random() * 24 * 3600 * 30139 t += random.random() * 24 * 3600 * 30
140 try:140 try:
141 time.gmtime(t)141 time.gmtime(t)
142 except OverflowError:142 except (OverflowError, ValueError):
143 # We've reached the maximum for time_t on this platform143 # We've reached the maximum for time_t on this platform
144 break144 break
145 if time.localtime(t).tm_year > 9998:145 if time.localtime(t).tm_year > 9998:

Subscribers

People subscribed via source and target branches