From: Debian Science Team Date: Sun, 16 Aug 2020 19:09:14 +0000 (+0100) Subject: Avoid test failures on Hurd X-Git-Tag: archive/raspbian/0.25.3+dfsg2-5+rpi1^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7ab36c39a456446ffe59127a2a9183e3c9bae44b;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 5dd166a5..5e57568d 100644 --- a/pandas/tests/io/parser/test_common.py +++ b/pandas/tests/io/parser/test_common.py @@ -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) diff --git a/pandas/tests/io/parser/test_multi_thread.py b/pandas/tests/io/parser/test_multi_thread.py index c94adf9d..9baa9c74 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 fe852a12..37d7a11a 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -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"