Avoid test failures on Hurd
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Mon, 21 Feb 2022 07:35:51 +0000 (07:35 +0000)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Mon, 21 Feb 2022 07:35:51 +0000 (07:35 +0000)
Allow multiprocessing to be unavailable
Accept any errno not just 2 for (intentionally) nonexistent files
(Hurd appears to use 2**30+2)

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no

Gbp-Pq: Name hurd_compat.patch

pandas/tests/io/parser/common/test_file_buffer_url.py
pandas/tests/io/parser/test_multi_thread.py
pandas/tests/io/test_common.py
pandas/tests/test_downstream.py

index 2a3d7328aa662864f855172ca4747bd7935ec44e..75b4ec0a6914166c286bf4d54d536c0e4b800ef2 100644 (file)
@@ -79,7 +79,7 @@ def test_nonexistent_path(all_parsers):
     parser = all_parsers
     path = f"{tm.rands(10)}.csv"
 
-    msg = r"\[Errno 2\]"
+    msg = r"\[Errno 2\]|\[Errno [0-9]+\] No such file or directory"
     with pytest.raises(FileNotFoundError, match=msg) as e:
         parser.read_csv(path)
     assert path == e.value.filename
index 981d1d438c3b0badca94cee9c85c36488666e3e3..bd03730644136fc35ee8cd5a7edbf60f3286d6e1 100644 (file)
@@ -4,7 +4,12 @@ parsing files for each parser defined in parsers.py
 """
 from contextlib import ExitStack
 from io import BytesIO
-from multiprocessing.pool import ThreadPool
+import pytest
+try:
+    from multiprocessing.pool import ThreadPool
+    ThreadPool()
+except ImportError:
+    pytest.skip("multiprocessing not available",allow_module_level=True)
 
 import numpy as np
 import pytest
index 41b21af147087d375aaed1b945a2efba9f1a12e2..e429d2dfb1be832f0cc9a12b5c570a50b87d78e3 100644 (file)
@@ -166,7 +166,7 @@ bar2,12,13,14,15
 
         path = os.path.join(HERE, "data", "does_not_exist." + fn_ext)
         msg1 = fr"File (b')?.+does_not_exist\.{fn_ext}'? does not exist"
-        msg2 = fr"\[Errno 2\] No such file or directory: '.+does_not_exist\.{fn_ext}'"
+        msg2 = fr"\[Errno [0-9]+\] No such file or directory: '.+does_not_exist\.{fn_ext}'"
         msg3 = "Expected object or value"
         msg4 = "path_or_buf needs to be a string file path or file-like"
         msg5 = (
@@ -209,7 +209,7 @@ bar2,12,13,14,15
         monkeypatch.setattr(icom, "_expand_user", lambda x: os.path.join("foo", x))
 
         msg1 = fr"File (b')?.+does_not_exist\.{fn_ext}'? does not exist"
-        msg2 = fr"\[Errno 2\] No such file or directory: '.+does_not_exist\.{fn_ext}'"
+        msg2 = fr"\[Errno [0-9]+\] No such file or directory: '.+does_not_exist\.{fn_ext}'"
         msg3 = "Unexpected character found when decoding 'false'"
         msg4 = "path_or_buf needs to be a string file path or file-like"
         msg5 = (
index e34ca9e7f9e275219713da49656a9db537feaa42..1e6af783e8f1fc2f77a33639110001bfe64ab66a 100644 (file)
@@ -33,6 +33,11 @@ def df():
 # https://github.com/dask/dask/pull/7318
 @td.skip_array_manager_not_yet_implemented
 def test_dask(df):
+    try:
+        from multiprocessing.pool import ThreadPool
+        ThreadPool()
+    except ImportError:
+        pytest.skip("multiprocessing not available")
 
     toolz = import_module("toolz")  # noqa
     dask = import_module("dask")  # noqa