Avoid test failures on Hurd
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Tue, 12 Jan 2021 21:06:04 +0000 (21:06 +0000)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Tue, 12 Jan 2021 21:06:04 +0000 (21:06 +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/test_common.py
pandas/tests/io/parser/test_multi_thread.py
pandas/tests/io/test_common.py
pandas/tests/test_downstream.py

index c59a68dac6dcf811fd1cd935d0b5ec1e7e31a93e..78d0f09f836c8f81b8e83709e04f2de7e3b41a1f 100644 (file)
@@ -961,7 +961,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 d50560c6840840eb4258fbabb8f6a792888abc74..c767e470497d247787716b4fc8bef325122980e3 100644 (file)
@@ -3,7 +3,12 @@ Tests multithreading behaviour for reading and
 parsing files for each parser defined in parsers.py
 """
 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 c064db345c948b79afbc0ff7a22e3579731e2e45..2d4cb08e72fc59f4f54d77ca85d70d94d97af079 100644 (file)
@@ -152,7 +152,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 = (
@@ -195,7 +195,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 4113ff6bb27d34a4247dafd71424b07697539041..86405bc173edf7908d37085aaf6325dcd7f965c8 100644 (file)
@@ -30,6 +30,11 @@ def df():
 
 
 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