Skip to content

Commit bac0684

Browse files
Backport PR #42487: CI: add back xfail for flaky chunksize test (#42491)
Co-authored-by: Matthew Zeitlin <[email protected]>
1 parent 45aeaac commit bac0684

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

pandas/tests/io/parser/common/test_chunksize.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,24 @@ def test_warn_if_chunks_have_mismatched_type(all_parsers, request):
191191

192192
buf = StringIO(data)
193193

194-
with tm.assert_produces_warning(warning_type):
195-
df = parser.read_csv(buf)
194+
try:
195+
with tm.assert_produces_warning(warning_type):
196+
df = parser.read_csv(buf)
197+
except AssertionError as err:
198+
# 2021-02-21 this occasionally fails on the CI with an unexpected
199+
# ResourceWarning that we have been unable to track down,
200+
# see GH#38630
201+
if "ResourceWarning" not in str(err) or parser.engine != "python":
202+
raise
203+
204+
# Check the main assertion of the test before re-raising
205+
assert df.a.dtype == object
206+
207+
mark = pytest.mark.xfail(
208+
reason="ResourceWarning for unclosed SSL Socket, GH#38630"
209+
)
210+
request.node.add_marker(mark)
211+
raise
196212

197213
assert df.a.dtype == object
198214

0 commit comments

Comments
 (0)