ci: harden chrono test, mark another macos 4.9 dev failure (#2448)
* ci: harden chrono test, mark another macos 4.9 dev failure
This should help with a little of the flakiness seen with the timing test
* Update tests/test_chrono.py
* Can also fail
diff --git a/tests/test_chrono.py b/tests/test_chrono.py
index f94d5ba..7678390 100644
--- a/tests/test_chrono.py
+++ b/tests/test_chrono.py
@@ -9,6 +9,7 @@
def test_chrono_system_clock():
# Get the time from both c++ and datetime
+ date0 = datetime.datetime.today()
date1 = m.test_chrono1()
date2 = datetime.datetime.today()
@@ -16,14 +17,15 @@
assert isinstance(date1, datetime.datetime)
# The numbers should vary by a very small amount (time it took to execute)
+ diff_python = abs(date2 - date0)
diff = abs(date1 - date2)
# There should never be a days difference
assert diff.days == 0
# Since datetime.datetime.today() calls time.time(), and on some platforms
- # that has 1 second accuracy, we should always be less than 2 seconds.
- assert diff.seconds < 2
+ # that has 1 second accuracy, we compare this way
+ assert diff.seconds <= diff_python.seconds
def test_chrono_system_clock_roundtrip():