@@ -141,7 +141,24 @@ def test_read_non_existant(self, reader, module, error_class, fn_ext):
141
141
pytest .importorskip (module )
142
142
143
143
path = os .path .join (HERE , "data" , "does_not_exist." + fn_ext )
144
- with tm .external_error_raised (error_class ):
144
+ msg1 = r"File (b')?.+does_not_exist\.{}'? does not exist" .format (fn_ext )
145
+ msg2 = fr"\[Errno 2\] No such file or directory: '.+does_not_exist\.{ fn_ext } '"
146
+ msg3 = "Expected object or value"
147
+ msg4 = "path_or_buf needs to be a string file path or file-like"
148
+ msg5 = (
149
+ fr"\[Errno 2\] File .+does_not_exist\.{ fn_ext } does not exist: "
150
+ fr"'.+does_not_exist\.{ fn_ext } '"
151
+ )
152
+ msg6 = fr"\[Errno 2\] 没有那个文件或目录: '.+does_not_exist\.{ fn_ext } '"
153
+ msg7 = (
154
+ fr"\[Errno 2\] File o directory non esistente: '.+does_not_exist\.{ fn_ext } '"
155
+ )
156
+ msg8 = fr"Failed to open local file.+does_not_exist\.{ fn_ext } "
157
+
158
+ with pytest .raises (
159
+ error_class ,
160
+ match = fr"({ msg1 } |{ msg2 } |{ msg3 } |{ msg4 } |{ msg5 } |{ msg6 } |{ msg7 } |{ msg8 } )" ,
161
+ ):
145
162
reader (path )
146
163
147
164
@pytest .mark .parametrize (
@@ -167,7 +184,24 @@ def test_read_expands_user_home_dir(
167
184
path = os .path .join ("~" , "does_not_exist." + fn_ext )
168
185
monkeypatch .setattr (icom , "_expand_user" , lambda x : os .path .join ("foo" , x ))
169
186
170
- with tm .external_error_raised (error_class ):
187
+ msg1 = fr"File (b')?.+does_not_exist\.{ fn_ext } '? does not exist"
188
+ msg2 = fr"\[Errno 2\] No such file or directory: '.+does_not_exist\.{ fn_ext } '"
189
+ msg3 = "Unexpected character found when decoding 'false'"
190
+ msg4 = "path_or_buf needs to be a string file path or file-like"
191
+ msg5 = (
192
+ fr"\[Errno 2\] File .+does_not_exist\.{ fn_ext } does not exist: "
193
+ fr"'.+does_not_exist\.{ fn_ext } '"
194
+ )
195
+ msg6 = fr"\[Errno 2\] 没有那个文件或目录: '.+does_not_exist\.{ fn_ext } '"
196
+ msg7 = (
197
+ fr"\[Errno 2\] File o directory non esistente: '.+does_not_exist\.{ fn_ext } '"
198
+ )
199
+ msg8 = fr"Failed to open local file.+does_not_exist\.{ fn_ext } "
200
+
201
+ with pytest .raises (
202
+ error_class ,
203
+ match = fr"({ msg1 } |{ msg2 } |{ msg3 } |{ msg4 } |{ msg5 } |{ msg6 } |{ msg7 } |{ msg8 } )" ,
204
+ ):
171
205
reader (path )
172
206
173
207
@pytest .mark .parametrize (
0 commit comments