From: Debian Science Team Date: Mon, 7 Dec 2020 23:06:28 +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^2^2^2^2^2~9 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=414f65a604f18cb58358f21931dc48d7995c2b34;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/test_common.py b/pandas/tests/io/parser/test_common.py index c59a68da..78d0f09f 100644 --- 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 diff --git a/pandas/tests/io/parser/test_multi_thread.py b/pandas/tests/io/parser/test_multi_thread.py index d50560c6..c767e470 100644 --- 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 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 diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index c064db34..2d4cb08e 100644 --- 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 = ( diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index 4113ff6b..86405bc1 100644 --- 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