Skip to content

TST: Skip more pyarrow csv tests that fail in pyarrow.csv.read_csv #56098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 23, 2023
16 changes: 9 additions & 7 deletions pandas/tests/io/parser/common/test_read_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ def test_error_bad_lines(all_parsers):
msg = "Expected 1 fields in line 3, saw 3"

if parser.engine == "pyarrow":
msg = "CSV parse error: Expected 1 columns, got 3: 1,2,3"
# "CSV parse error: Expected 1 columns, got 3: 1,2,3"
pytest.skip(reason="https://github.com/apache/arrow/issues/38676")

with pytest.raises(ParserError, match=msg):
parser.read_csv(StringIO(data), on_bad_lines="error")
Expand Down Expand Up @@ -222,7 +223,8 @@ def test_read_csv_wrong_num_columns(all_parsers):
msg = "Expected 6 fields in line 3, saw 7"

if parser.engine == "pyarrow":
msg = "Expected 6 columns, got 7: 6,7,8,9,10,11,12"
# Expected 6 columns, got 7: 6,7,8,9,10,11,12
pytest.skip(reason="https://github.com/apache/arrow/issues/38676")

with pytest.raises(ParserError, match=msg):
parser.read_csv(StringIO(data))
Expand All @@ -246,10 +248,9 @@ def test_null_byte_char(request, all_parsers):
tm.assert_frame_equal(out, expected)
else:
if parser.engine == "pyarrow":
msg = (
"CSV parse error: Empty CSV file or block: "
"cannot infer number of columns"
)
# CSV parse error: Empty CSV file or block: "
# cannot infer number of columns"
pytest.skip(reason="https://github.com/apache/arrow/issues/38676")
else:
msg = "NULL byte detected"
with pytest.raises(ParserError, match=msg):
Expand Down Expand Up @@ -299,7 +300,8 @@ def test_bad_header_uniform_error(all_parsers):
"number of columns, but 3 left to parse."
)
elif parser.engine == "pyarrow":
msg = "CSV parse error: Expected 1 columns, got 4: col1,col2,col3,col4"
# "CSV parse error: Expected 1 columns, got 4: col1,col2,col3,col4"
pytest.skip(reason="https://github.com/apache/arrow/issues/38676")

with pytest.raises(ParserError, match=msg):
parser.read_csv(StringIO(data), index_col=0, on_bad_lines="error")
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/io/parser/test_unsupported.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def test_close_file_handle_on_invalid_usecols(all_parsers):

error = ValueError
if parser.engine == "pyarrow":
pyarrow = pytest.importorskip("pyarrow")
error = pyarrow.lib.ArrowKeyError
# Raises pyarrow.lib.ArrowKeyError
pytest.skip(reason="https://github.com/apache/arrow/issues/38676")

with tm.ensure_clean("test.csv") as fname:
Path(fname).write_text("col1,col2\na,b\n1,2", encoding="utf-8")
Expand Down
7 changes: 2 additions & 5 deletions pandas/tests/io/parser/usecols/test_usecols_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,8 @@ def test_usecols_subset_names_mismatch_orig_columns(all_parsers, usecols, reques
with pytest.raises(ValueError, match=_msg_pyarrow_requires_names):
parser.read_csv(StringIO(data), header=0, names=names, usecols=usecols)
return
mark = pytest.mark.xfail(
reason="pyarrow.lib.ArrowKeyError: Column 'A' in include_columns "
"does not exist"
)
request.applymarker(mark)
# "pyarrow.lib.ArrowKeyError: Column 'A' in include_columns does not exist"
pytest.skip(reason="https://github.com/apache/arrow/issues/38676")

result = parser.read_csv(StringIO(data), header=0, names=names, usecols=usecols)
expected = DataFrame({"A": [1, 5], "C": [3, 7]})
Expand Down