Avoid test failures on Hurd
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Wed, 26 Aug 2020 21:34:50 +0000 (22:34 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Wed, 26 Aug 2020 21:34:50 +0000 (22:34 +0100)
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

index 8fb0d8da8139dcd318a95f0950a0bf66020095b4..682dd719a66fb40cdea506b2bba1ef7ae4585101 100644 (file)
@@ -960,7 +960,7 @@ def test_nonexistent_path(all_parsers):
     parser = all_parsers
     path = "{}.csv".format(tm.rands(10))
 
-    msg = f"File {path} does not exist" if parser.engine == "c" else r"\[Errno 2\]"
+    msg = f"File {path} does not exist" if parser.engine == "c" else r"\[Errno 2\]|\[Errno [0-9]+\] No such file or directory"
     with pytest.raises(FileNotFoundError, match=msg) as e:
         parser.read_csv(path)
 
index 64ccaf60ec230ce554a6952889d0ca66c1d7b90f..9b8555731f59e3678342dae12eec2f007bd16816 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(reason="multiprocessing not available",allow_module_level=True)
 
 import numpy as np
 
index 5754f1666dfe1e1311f84ac1fbc5d2874593dae7..1aa97762bb7ff42d4a6e6c33d6643b31f2e32bd9 100644 (file)
@@ -142,7 +142,7 @@ bar2,12,13,14,15
 
         path = os.path.join(HERE, "data", "does_not_exist." + fn_ext)
         msg1 = r"File (b')?.+does_not_exist\.{}'? does not exist".format(fn_ext)
-        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 = (
@@ -182,7 +182,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 = (