From befe03ea489ba3f3d3046471708bc28d2924ddc6 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 7 Feb 2020 12:44:36 -0800 Subject: [PATCH 1/4] CI: fix feather test --- pandas/tests/io/test_common.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index d7a21b27308e8..7b41069cd9bd1 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -154,10 +154,14 @@ def test_read_non_existant(self, reader, module, error_class, fn_ext): fr"\[Errno 2\] File o directory non esistente: '.+does_not_exist\.{fn_ext}'" ) msg8 = fr"Failed to open local file.+does_not_exist\.{fn_ext}.?, error: .*" - + msg9 = ( + # Encountered in feather 2020-02-07 + fr"\[Errno 2\] Failed to open local file '.*does_not_exist\.{fn_ext}'. " + r"Detail: \[errno 2] 没有那个文件或目录" + ) with pytest.raises( error_class, - match=fr"({msg1}|{msg2}|{msg3}|{msg4}|{msg5}|{msg6}|{msg7}|{msg8})", + match=fr"({msg1}|{msg2}|{msg3}|{msg4}|{msg5}|{msg6}|{msg7}|{msg8}|{msg9})", ): reader(path) From 12dbbcd12ad2cf1e8096694be56ff586f74e86bb Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 7 Feb 2020 13:57:41 -0800 Subject: [PATCH 2/4] typo --- pandas/tests/io/test_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index 7b41069cd9bd1..37ef2fa6cdacd 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -157,7 +157,7 @@ def test_read_non_existant(self, reader, module, error_class, fn_ext): msg9 = ( # Encountered in feather 2020-02-07 fr"\[Errno 2\] Failed to open local file '.*does_not_exist\.{fn_ext}'. " - r"Detail: \[errno 2] 没有那个文件或目录" + r"Detail: \[errno 2\] 没有那个文件或目录" ) with pytest.raises( error_class, From 227b1d8e52338fe3d5ab32d40ba8e303d0b1366e Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 7 Feb 2020 14:20:50 -0800 Subject: [PATCH 3/4] use external_error_raised --- pandas/tests/io/test_common.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index 37ef2fa6cdacd..a797c32cc7015 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -141,28 +141,7 @@ def test_read_non_existant(self, reader, module, error_class, fn_ext): pytest.importorskip(module) 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}'" - msg3 = "Expected object or value" - msg4 = "path_or_buf needs to be a string file path or file-like" - msg5 = ( - fr"\[Errno 2\] File .+does_not_exist\.{fn_ext} does not exist: " - fr"'.+does_not_exist\.{fn_ext}'" - ) - msg6 = fr"\[Errno 2\] 没有那个文件或目录: '.+does_not_exist\.{fn_ext}'" - msg7 = ( - fr"\[Errno 2\] File o directory non esistente: '.+does_not_exist\.{fn_ext}'" - ) - msg8 = fr"Failed to open local file.+does_not_exist\.{fn_ext}.?, error: .*" - msg9 = ( - # Encountered in feather 2020-02-07 - fr"\[Errno 2\] Failed to open local file '.*does_not_exist\.{fn_ext}'. " - r"Detail: \[errno 2\] 没有那个文件或目录" - ) - with pytest.raises( - error_class, - match=fr"({msg1}|{msg2}|{msg3}|{msg4}|{msg5}|{msg6}|{msg7}|{msg8}|{msg9})", - ): + with tm.external_error_raised(error_class): reader(path) @pytest.mark.parametrize( From f9bd72a220a0889d4fa1730aa81e4adbc421c028 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 7 Feb 2020 14:54:16 -0800 Subject: [PATCH 4/4] troubleshoot --- pandas/tests/io/test_common.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index a797c32cc7015..404f5a477187b 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -167,24 +167,7 @@ def test_read_expands_user_home_dir( path = os.path.join("~", "does_not_exist." + fn_ext) 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}'" - msg3 = "Unexpected character found when decoding 'false'" - msg4 = "path_or_buf needs to be a string file path or file-like" - msg5 = ( - fr"\[Errno 2\] File .+does_not_exist\.{fn_ext} does not exist: " - fr"'.+does_not_exist\.{fn_ext}'" - ) - msg6 = fr"\[Errno 2\] 没有那个文件或目录: '.+does_not_exist\.{fn_ext}'" - msg7 = ( - fr"\[Errno 2\] File o directory non esistente: '.+does_not_exist\.{fn_ext}'" - ) - msg8 = fr"Failed to open local file.+does_not_exist\.{fn_ext}.?, error: .*" - - with pytest.raises( - error_class, - match=fr"({msg1}|{msg2}|{msg3}|{msg4}|{msg5}|{msg6}|{msg7}|{msg8})", - ): + with tm.external_error_raised(error_class): reader(path) @pytest.mark.parametrize(