tests: loosen test, not valid on some systems (#2399)

This commit is contained in:
Henry Schreiner 2020-08-16 11:18:47 -04:00 committed by GitHub
parent cd85699212
commit a876aac2cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,14 +15,12 @@ def test_chrono_system_clock():
# The numbers should vary by a very small amount (time it took to execute) # The numbers should vary by a very small amount (time it took to execute)
diff = abs(date1 - date2) diff = abs(date1 - date2)
# There should never be a days/seconds difference # There should never be a days difference
assert diff.days == 0 assert diff.days == 0
assert diff.seconds == 0
# We test that no more than about 0.5 seconds passes here # Since datetime.datetime.today() calls time.time(), and on some platforms
# This makes sure that the dates created are very close to the same # that has 1 second accuracy, we should always be less than 2 seconds.
# but if the testing system is incredibly overloaded this should still pass assert diff.seconds < 2
assert diff.microseconds < 500000
def test_chrono_system_clock_roundtrip(): def test_chrono_system_clock_roundtrip():