Skip to content

ci: harden chrono test, mark another macos 4.9 dev failure #2448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/test_chrono.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@
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()

# The returned value should be a datetime
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():
Expand Down
4 changes: 4 additions & 0 deletions tests/test_gil_scoped.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.

Expand Down