From: Debian Science Team Date: Mon, 21 Feb 2022 07:35:51 +0000 (+0000) Subject: Avoid test failures on Hurd X-Git-Tag: archive/raspbian/1.5.3+dfsg-2+rpi1~1^2^2^2^2^2^2~12 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9f48978178d202b3f0ad064c7295050e0dbedbce;p=pandas.git 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 Forwarded: no Gbp-Pq: Name hurd_compat.patch --- diff --git a/pandas/tests/io/parser/common/test_file_buffer_url.py b/pandas/tests/io/parser/common/test_file_buffer_url.py index 2a3d7328..75b4ec0a 100644 --- a/pandas/tests/io/parser/common/test_file_buffer_url.py +++ b/pandas/tests/io/parser/common/test_file_buffer_url.py @@ -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 diff --git a/pandas/tests/io/parser/test_multi_thread.py b/pandas/tests/io/parser/test_multi_thread.py index 981d1d43..bd037306 100644 --- a/pandas/tests/io/parser/test_multi_thread.py +++ b/pandas/tests/io/parser/test_multi_thread.py @@ -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 diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index 41b21af1..e429d2df 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -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 = ( diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index e34ca9e7..1e6af783 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -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