Skip to content

Commit

Permalink
Catch Py312+ warning when using ratarmount
Browse files Browse the repository at this point in the history
  • Loading branch information
cphyc committed Feb 15, 2024
1 parent 8be1f8b commit dea5e73
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions yt/tests/test_load_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,22 @@ def test_load_archive(
tar.addfile(member, fileobj=content)

# Now try to open the .tar.* files
warn_msg = "The 'load_archive' function is still experimental and may be unstable."
with pytest.warns(UserWarning, match=warn_msg):
ds = load_archive(tar_path, exact_loc, mount_timeout=10)
yt_warn_msg = (
"The 'load_archive' function is still experimental and may be unstable."
)

with pytest.warns(UserWarning, match=yt_warn_msg):
if sys.version_info >= (3, 12):
# On Python 3.12+, there is a deprecation warning when calling os.fork()
# in a multi-threaded process
py312_warning = (
r"This process \(pid=\d+\) is multi-threaded, use of fork\(\) "
r"may lead to deadlocks in the child\."
)
with pytest.warns(DeprecationWarning, match=py312_warning):
ds = load_archive(tar_path, exact_loc, mount_timeout=10)
else:
ds = load_archive(tar_path, exact_loc, mount_timeout=10)
assert type(ds).__name__ == class_

# Make sure the index is readable
Expand Down

0 comments on commit dea5e73

Please sign in to comment.