Skip to content

Commit e2d6801

Browse files
authored
CI: add back xfail for flaky chunksize test (#42487)
1 parent 55a03d2 commit e2d6801

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
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)