1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
Description: Avoid test failures on Hurd
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
--- a/pandas/tests/io/parser/test_common.py
+++ b/pandas/tests/io/parser/test_common.py
@@ -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
--- a/pandas/tests/io/parser/test_multi_thread.py
+++ b/pandas/tests/io/parser/test_multi_thread.py
@@ -3,7 +3,12 @@ Tests multithreading behaviour for readi
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
--- a/pandas/tests/test_downstream.py
+++ b/pandas/tests/test_downstream.py
@@ -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
--- a/pandas/tests/io/test_common.py
+++ b/pandas/tests/io/test_common.py
@@ -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 = (
|