File tree 1 file changed +22
-3
lines changed
pandas/tests/io/parser/common
1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ def test_chunks_have_consistent_numerical_type(all_parsers):
173
173
assert result .a .dtype == float
174
174
175
175
176
- def test_warn_if_chunks_have_mismatched_type (all_parsers ):
176
+ def test_warn_if_chunks_have_mismatched_type (all_parsers , request ):
177
177
warning_type = None
178
178
parser = all_parsers
179
179
integers = [str (i ) for i in range (499999 )]
@@ -184,8 +184,27 @@ def test_warn_if_chunks_have_mismatched_type(all_parsers):
184
184
if parser .engine == "c" and parser .low_memory :
185
185
warning_type = DtypeWarning
186
186
187
- with tm .assert_produces_warning (warning_type ):
188
- df = parser .read_csv (StringIO (data ))
187
+ buf = StringIO (data )
188
+
189
+ try :
190
+ with tm .assert_produces_warning (warning_type ):
191
+ df = parser .read_csv (buf )
192
+ except AssertionError as err :
193
+ # 2021-02-21 this occasionally fails on the CI with an unexpected
194
+ # ResourceWarning that we have been unable to track down,
195
+ # see GH#38630
196
+ if "ResourceError" not in str (err ) or parser .engine != "python" :
197
+ raise
198
+
199
+ # Check the main assertion of the test before re-raising
200
+ assert df .a .dtype == object
201
+
202
+ mark = pytest .mark .xfail (
203
+ reason = "ResourceWarning for unclosed SSL Socket, GH#38630"
204
+ )
205
+ request .node .add_marker (mark )
206
+ raise
207
+
189
208
assert df .a .dtype == object
190
209
191
210
You can’t perform that action at this time.
0 commit comments