Skip to content

Commit 3a89bff

Browse files
authored
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
1 parent fb0a3a0 commit 3a89bff

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/test_chrono.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,23 @@
99
def test_chrono_system_clock():
1010

1111
# Get the time from both c++ and datetime
12+
date0 = datetime.datetime.today()
1213
date1 = m.test_chrono1()
1314
date2 = datetime.datetime.today()
1415

1516
# The returned value should be a datetime
1617
assert isinstance(date1, datetime.datetime)
1718

1819
# The numbers should vary by a very small amount (time it took to execute)
20+
diff_python = abs(date2 - date0)
1921
diff = abs(date1 - date2)
2022

2123
# There should never be a days difference
2224
assert diff.days == 0
2325

2426
# Since datetime.datetime.today() calls time.time(), and on some platforms
25-
# that has 1 second accuracy, we should always be less than 2 seconds.
26-
assert diff.seconds < 2
27+
# that has 1 second accuracy, we compare this way
28+
assert diff.seconds <= diff_python.seconds
2729

2830

2931
def test_chrono_system_clock_roundtrip():

tests/test_gil_scoped.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def _python_to_cpp_to_python_from_threads(num_threads, parallel=False):
5454
thread.join()
5555

5656

57+
# TODO: FIXME, sometimes returns -11 instead of 0
58+
@pytest.mark.xfail("env.PY > (3,8) and env.MACOS", strict=False)
5759
def test_python_to_cpp_to_python_from_thread():
5860
"""Makes sure there is no GIL deadlock when running in a thread.
5961
@@ -72,6 +74,8 @@ def test_python_to_cpp_to_python_from_thread_multiple_parallel():
7274
assert _run_in_process(_python_to_cpp_to_python_from_threads, 8, parallel=True) == 0
7375

7476

77+
# TODO: FIXME
78+
@pytest.mark.xfail("env.PY > (3,8) and env.MACOS", strict=False)
7579
def test_python_to_cpp_to_python_from_thread_multiple_sequential():
7680
"""Makes sure there is no GIL deadlock when running in a thread multiple times sequentially.
7781

0 commit comments

Comments
 (0)