diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-04-22 07:36:24 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-04-22 07:36:24 -0400 |
commit | 5d35a6e0ce6b96b37843a0e8f0fa52f3d015cb10 (patch) | |
tree | 472b5fcde9d793c6ccc4445abda44f3dfc2636ed /tests/test_html.py | |
parent | 39704e37e078009ecec085b4a7fb26e32c0188a2 (diff) | |
download | python-coveragepy-git-5d35a6e0ce6b96b37843a0e8f0fa52f3d015cb10.tar.gz |
Make datetime imperviousness work on 2.6
Diffstat (limited to 'tests/test_html.py')
-rw-r--r-- | tests/test_html.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_html.py b/tests/test_html.py index 2de6b68e..6f0b294a 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -387,12 +387,14 @@ class HtmlTest(HtmlTestHelpers, CoverageTest): self.assertTrue(m, "Didn't find a timestamp!") timestamp = datetime.datetime(*map(int, m.groups())) age = datetime.datetime.now() - timestamp + # Python2.6 doesn't have total_seconds :( + self.assertEqual(age.days, 0) # The timestamp only records the minute, so the delta could be from # 12:00 to 12:01:59, or two minutes. self.assertLessEqual( - abs(age.total_seconds()), + abs(age.seconds), 120, - "Timestamp is wrong: {}".format(timestamp) + "Timestamp is wrong: {0}".format(timestamp) ) |