Avoid test failures on Hurd
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Sun, 16 Aug 2020 19:09:14 +0000 (20:09 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Sun, 16 Aug 2020 19:09:14 +0000 (20:09 +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 5dd166a550b5752477d8c29f7c73f6f2f176fecc..5e57568dfe8102841d5d5fabbfa840835b8c9344 100644 (file)
@@ -981,7 +981,7 @@ def test_nonexistent_path(all_parsers):
     parser = all_parsers
     path = "{}.csv".format(tm.rands(10))
 
-    msg = "does not exist" if parser.engine == "c" else r"\[Errno 2\]"
+    msg = "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 c94adf9da0bf3be20c7f8806be7563b212b1a1b8..9baa9c74e24f1d98178c1f03a0f8e14141df5211 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 fe852a1243d052bd3adc147408025fdc006bbd13..37d7a11ad8cbdb521fb0c76ad80f70a536cab23b 100644 (file)
@@ -153,7 +153,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 = (
-            r"\[Errno 2\] No such file or directory: '.+does_not_exist" r"\.{}'"
+            r"\[Errno [0-9]+\] No such file or directory: '.+does_not_exist" r"\.{}'"
         ).format(fn_ext)
         msg3 = "Expected object or value"
         msg4 = "path_or_buf needs to be a string file path or file-like"
@@ -192,7 +192,7 @@ bar2,12,13,14,15
 
         msg1 = r"File (b')?.+does_not_exist\.{}'? does not exist".format(fn_ext)
         msg2 = (
-            r"\[Errno 2\] No such file or directory:" r" '.+does_not_exist\.{}'"
+            r"\[Errno [0-9]+\] No such file or directory:" r" '.+does_not_exist\.{}'"
         ).format(fn_ext)
         msg3 = "Unexpected character found when decoding 'false'"
         msg4 = "path_or_buf needs to be a string file path or file-like"