From: Debian Science Team Date: Wed, 26 Aug 2020 21:34:50 +0000 (+0100) Subject: Avoid test failures on Hurd X-Git-Tag: archive/raspbian/1.0.5+dfsg-3+rpi1^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9dfec21e38ea424378ceb05ffa4fad20cde74977;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 8fb0d8da..682dd719 100644 --- a/pandas/tests/io/parser/test_common.py +++ b/pandas/tests/io/parser/test_common.py @@ -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) diff --git a/pandas/tests/io/parser/test_multi_thread.py b/pandas/tests/io/parser/test_multi_thread.py index 64ccaf60..9b855573 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(reason="multiprocessing not available",allow_module_level=True) import numpy as np diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index 5754f166..1aa97762 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -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 = (