mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
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
This commit is contained in:
parent
fb0a3a0e82
commit
3a89bffac0
@ -9,6 +9,7 @@ import env # noqa: F401
|
||||
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 @@ def test_chrono_system_clock():
|
||||
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():
|
||||
|
@ -54,6 +54,8 @@ def _python_to_cpp_to_python_from_threads(num_threads, parallel=False):
|
||||
thread.join()
|
||||
|
||||
|
||||
# TODO: FIXME, sometimes returns -11 instead of 0
|
||||
@pytest.mark.xfail("env.PY > (3,8) and env.MACOS", strict=False)
|
||||
def test_python_to_cpp_to_python_from_thread():
|
||||
"""Makes sure there is no GIL deadlock when running in a thread.
|
||||
|
||||
@ -72,6 +74,8 @@ def test_python_to_cpp_to_python_from_thread_multiple_parallel():
|
||||
assert _run_in_process(_python_to_cpp_to_python_from_threads, 8, parallel=True) == 0
|
||||
|
||||
|
||||
# TODO: FIXME
|
||||
@pytest.mark.xfail("env.PY > (3,8) and env.MACOS", strict=False)
|
||||
def test_python_to_cpp_to_python_from_thread_multiple_sequential():
|
||||
"""Makes sure there is no GIL deadlock when running in a thread multiple times sequentially.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user