Skip to content

Commit df82819

Browse files
TST: change pyarrow skips to xfails (#55637)
Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 54fe86a commit df82819

13 files changed

+146
-22
lines changed

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616
)
1717
import pandas._testing as tm
1818

19-
pytestmark = pytest.mark.usefixtures("pyarrow_skip")
19+
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
20+
pytestmark = pytest.mark.filterwarnings(
21+
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
22+
)
2023

2124

25+
@xfail_pyarrow # The 'chunksize' option is not supported
2226
@pytest.mark.parametrize("index_col", [0, "index"])
2327
def test_read_chunksize_with_index(all_parsers, index_col):
2428
parser = all_parsers
@@ -51,6 +55,7 @@ def test_read_chunksize_with_index(all_parsers, index_col):
5155
tm.assert_frame_equal(chunks[2], expected[4:])
5256

5357

58+
@xfail_pyarrow # AssertionError: Regex pattern did not match
5459
@pytest.mark.parametrize("chunksize", [1.3, "foo", 0])
5560
def test_read_chunksize_bad(all_parsers, chunksize):
5661
data = """index,A,B,C,D
@@ -69,6 +74,7 @@ def test_read_chunksize_bad(all_parsers, chunksize):
6974
pass
7075

7176

77+
@xfail_pyarrow # The 'nrows' option is not supported
7278
@pytest.mark.parametrize("chunksize", [2, 8])
7379
def test_read_chunksize_and_nrows(all_parsers, chunksize):
7480
# see gh-15755
@@ -88,6 +94,7 @@ def test_read_chunksize_and_nrows(all_parsers, chunksize):
8894
tm.assert_frame_equal(concat(reader), expected)
8995

9096

97+
@xfail_pyarrow # The 'chunksize' option is not supported
9198
def test_read_chunksize_and_nrows_changing_size(all_parsers):
9299
data = """index,A,B,C,D
93100
foo,2,3,4,5
@@ -109,6 +116,7 @@ def test_read_chunksize_and_nrows_changing_size(all_parsers):
109116
reader.get_chunk(size=3)
110117

111118

119+
@xfail_pyarrow # The 'chunksize' option is not supported
112120
def test_get_chunk_passed_chunksize(all_parsers):
113121
parser = all_parsers
114122
data = """A,B,C
@@ -124,6 +132,7 @@ def test_get_chunk_passed_chunksize(all_parsers):
124132
tm.assert_frame_equal(result, expected)
125133

126134

135+
@xfail_pyarrow # The 'chunksize' option is not supported
127136
@pytest.mark.parametrize("kwargs", [{}, {"index_col": 0}])
128137
def test_read_chunksize_compat(all_parsers, kwargs):
129138
# see gh-12185
@@ -141,6 +150,7 @@ def test_read_chunksize_compat(all_parsers, kwargs):
141150
tm.assert_frame_equal(concat(reader), result)
142151

143152

153+
@xfail_pyarrow # The 'chunksize' option is not supported
144154
def test_read_chunksize_jagged_names(all_parsers):
145155
# see gh-23509
146156
parser = all_parsers
@@ -171,7 +181,11 @@ def test_chunks_have_consistent_numerical_type(all_parsers, monkeypatch):
171181
data = "a\n" + "\n".join(integers + ["1.0", "2.0"] + integers)
172182

173183
# Coercions should work without warnings.
174-
with tm.assert_produces_warning(None):
184+
warn = None
185+
if parser.engine == "pyarrow":
186+
warn = DeprecationWarning
187+
depr_msg = "Passing a BlockManager to DataFrame"
188+
with tm.assert_produces_warning(warn, match=depr_msg, check_stacklevel=False):
175189
with monkeypatch.context() as m:
176190
m.setattr(libparsers, "DEFAULT_BUFFER_HEURISTIC", heuristic)
177191
result = parser.read_csv(StringIO(data))
@@ -180,6 +194,7 @@ def test_chunks_have_consistent_numerical_type(all_parsers, monkeypatch):
180194
assert result.a.dtype == float
181195

182196

197+
@xfail_pyarrow # ValueError: The 'chunksize' option is not supported
183198
def test_warn_if_chunks_have_mismatched_type(all_parsers):
184199
warning_type = None
185200
parser = all_parsers
@@ -207,6 +222,7 @@ def test_warn_if_chunks_have_mismatched_type(all_parsers):
207222
assert df.a.dtype == object
208223

209224

225+
@xfail_pyarrow # ValueError: The 'chunksize' option is not supported
210226
@pytest.mark.parametrize("iterator", [True, False])
211227
def test_empty_with_nrows_chunksize(all_parsers, iterator):
212228
# see gh-9535
@@ -225,6 +241,7 @@ def test_empty_with_nrows_chunksize(all_parsers, iterator):
225241
tm.assert_frame_equal(result, expected)
226242

227243

244+
@xfail_pyarrow # ValueError: The 'chunksize' option is not supported
228245
def test_read_csv_memory_growth_chunksize(all_parsers):
229246
# see gh-24805
230247
#
@@ -242,6 +259,7 @@ def test_read_csv_memory_growth_chunksize(all_parsers):
242259
pass
243260

244261

262+
@xfail_pyarrow # ValueError: The 'chunksize' option is not supported
245263
def test_chunksize_with_usecols_second_block_shorter(all_parsers):
246264
# GH#21211
247265
parser = all_parsers
@@ -267,6 +285,7 @@ def test_chunksize_with_usecols_second_block_shorter(all_parsers):
267285
tm.assert_frame_equal(result, expected_frames[i])
268286

269287

288+
@xfail_pyarrow # ValueError: The 'chunksize' option is not supported
270289
def test_chunksize_second_block_shorter(all_parsers):
271290
# GH#21211
272291
parser = all_parsers

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
from pandas import DataFrame
2323
import pandas._testing as tm
2424

25-
# TODO(1.4) Please xfail individual tests at release time
26-
# instead of skip
27-
pytestmark = pytest.mark.usefixtures("pyarrow_skip")
25+
pytestmark = pytest.mark.filterwarnings(
26+
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
27+
)
28+
29+
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
2830

2931

3032
@pytest.mark.network
@@ -60,13 +62,15 @@ def test_local_file(all_parsers, csv_dir_path):
6062
pytest.skip("Failing on: " + " ".join(platform.uname()))
6163

6264

65+
@xfail_pyarrow # AssertionError: DataFrame.index are different
6366
def test_path_path_lib(all_parsers):
6467
parser = all_parsers
6568
df = tm.makeDataFrame()
6669
result = tm.round_trip_pathlib(df.to_csv, lambda p: parser.read_csv(p, index_col=0))
6770
tm.assert_frame_equal(df, result)
6871

6972

73+
@xfail_pyarrow # AssertionError: DataFrame.index are different
7074
def test_path_local_path(all_parsers):
7175
parser = all_parsers
7276
df = tm.makeDataFrame()
@@ -206,10 +210,14 @@ def test_no_permission(all_parsers):
206210
"in-quoted-field",
207211
],
208212
)
209-
def test_eof_states(all_parsers, data, kwargs, expected, msg):
213+
def test_eof_states(all_parsers, data, kwargs, expected, msg, request):
210214
# see gh-10728, gh-10548
211215
parser = all_parsers
212216

217+
if parser.engine == "pyarrow" and "\r" not in data:
218+
mark = pytest.mark.xfail(reason="The 'comment' option is not supported")
219+
request.applymarker(mark)
220+
213221
if expected is None:
214222
with pytest.raises(ParserError, match=msg):
215223
parser.read_csv(StringIO(data), **kwargs)
@@ -218,6 +226,7 @@ def test_eof_states(all_parsers, data, kwargs, expected, msg):
218226
tm.assert_frame_equal(result, expected)
219227

220228

229+
@xfail_pyarrow # ValueError: the 'pyarrow' engine does not support regex separators
221230
def test_temporary_file(all_parsers):
222231
# see gh-13398
223232
parser = all_parsers
@@ -347,6 +356,7 @@ def test_read_csv_file_handle(all_parsers, io_class, encoding):
347356
assert not handle.closed
348357

349358

359+
@xfail_pyarrow # ValueError: The 'memory_map' option is not supported
350360
def test_memory_map_compression(all_parsers, compression):
351361
"""
352362
Support memory map for compressed files.
@@ -365,6 +375,7 @@ def test_memory_map_compression(all_parsers, compression):
365375
)
366376

367377

378+
@xfail_pyarrow # ValueError: The 'chunksize' option is not supported
368379
def test_context_manager(all_parsers, datapath):
369380
# make sure that opened files are closed
370381
parser = all_parsers
@@ -381,6 +392,7 @@ def test_context_manager(all_parsers, datapath):
381392
assert reader.handles.handle.closed
382393

383394

395+
@xfail_pyarrow # ValueError: The 'chunksize' option is not supported
384396
def test_context_manageri_user_provided(all_parsers, datapath):
385397
# make sure that user-provided handles are not closed
386398
parser = all_parsers
@@ -396,6 +408,7 @@ def test_context_manageri_user_provided(all_parsers, datapath):
396408
assert not reader.handles.handle.closed
397409

398410

411+
@xfail_pyarrow # ParserError: Empty CSV file
399412
def test_file_descriptor_leak(all_parsers, using_copy_on_write):
400413
# GH 31488
401414
parser = all_parsers
@@ -404,6 +417,7 @@ def test_file_descriptor_leak(all_parsers, using_copy_on_write):
404417
parser.read_csv(path)
405418

406419

420+
@xfail_pyarrow # ValueError: The 'memory_map' option is not supported
407421
def test_memory_map(all_parsers, csv_dir_path):
408422
mmap_file = os.path.join(csv_dir_path, "test_mmap.csv")
409423
parser = all_parsers

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
from pandas import DataFrame
1313
import pandas._testing as tm
1414

15-
pytestmark = pytest.mark.usefixtures("pyarrow_skip")
15+
pytestmark = pytest.mark.filterwarnings(
16+
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
17+
)
18+
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
1619

1720

21+
@xfail_pyarrow # ParserError: CSV parse error: Empty CSV file or block
1822
def test_float_parser(all_parsers):
1923
# see gh-9565
2024
parser = all_parsers
@@ -46,6 +50,7 @@ def test_very_negative_exponent(all_parsers_all_precisions, neg_exp):
4650
tm.assert_frame_equal(result, expected)
4751

4852

53+
@xfail_pyarrow
4954
@pytest.mark.parametrize("exp", [999999999999999999, -999999999999999999])
5055
def test_too_many_exponent_digits(all_parsers_all_precisions, exp, request):
5156
# GH#38753

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
)
1313
import pandas._testing as tm
1414

15-
pytestmark = pytest.mark.usefixtures("pyarrow_skip")
15+
pytestmark = pytest.mark.filterwarnings(
16+
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
17+
)
18+
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
1619

1720

21+
@xfail_pyarrow # ValueError: The 'iterator' option is not supported
1822
def test_iterator(all_parsers):
1923
# see gh-6607
2024
data = """index,A,B,C,D
@@ -37,6 +41,7 @@ def test_iterator(all_parsers):
3741
tm.assert_frame_equal(last_chunk, expected[3:])
3842

3943

44+
@xfail_pyarrow # ValueError: The 'iterator' option is not supported
4045
def test_iterator2(all_parsers):
4146
parser = all_parsers
4247
data = """A,B,C
@@ -56,6 +61,7 @@ def test_iterator2(all_parsers):
5661
tm.assert_frame_equal(result[0], expected)
5762

5863

64+
@xfail_pyarrow # ValueError: The 'chunksize' option is not supported
5965
def test_iterator_stop_on_chunksize(all_parsers):
6066
# gh-3967: stopping iteration when chunksize is specified
6167
parser = all_parsers
@@ -77,6 +83,7 @@ def test_iterator_stop_on_chunksize(all_parsers):
7783
tm.assert_frame_equal(concat(result), expected)
7884

7985

86+
@xfail_pyarrow # AssertionError: Regex pattern did not match
8087
@pytest.mark.parametrize(
8188
"kwargs", [{"iterator": True, "chunksize": 1}, {"iterator": True}, {"chunksize": 1}]
8289
)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
import pytest
88

9-
pytestmark = pytest.mark.usefixtures("pyarrow_skip")
9+
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
1010

1111

12+
@xfail_pyarrow # ValueError: The 'verbose' option is not supported
1213
def test_verbose_read(all_parsers, capsys):
1314
parser = all_parsers
1415
data = """a,b,c,d
@@ -32,6 +33,7 @@ def test_verbose_read(all_parsers, capsys):
3233
assert captured.out == "Filled 3 NA values in column a\n"
3334

3435

36+
@xfail_pyarrow # ValueError: The 'verbose' option is not supported
3537
def test_verbose_read2(all_parsers, capsys):
3638
parser = all_parsers
3739
data = """a,b,c,d

pandas/tests/io/parser/dtypes/test_empty.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
)
1818
import pandas._testing as tm
1919

20-
# TODO(1.4): Change me into individual xfails at release time
21-
pytestmark = pytest.mark.usefixtures("pyarrow_skip")
20+
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
2221

2322

23+
@xfail_pyarrow # CSV parse error: Empty CSV file or block
2424
def test_dtype_all_columns_empty(all_parsers):
2525
# see gh-12048
2626
parser = all_parsers
@@ -30,6 +30,7 @@ def test_dtype_all_columns_empty(all_parsers):
3030
tm.assert_frame_equal(result, expected)
3131

3232

33+
@xfail_pyarrow # CSV parse error: Empty CSV file or block
3334
def test_empty_pass_dtype(all_parsers):
3435
parser = all_parsers
3536

@@ -42,6 +43,7 @@ def test_empty_pass_dtype(all_parsers):
4243
tm.assert_frame_equal(result, expected)
4344

4445

46+
@xfail_pyarrow # CSV parse error: Empty CSV file or block
4547
def test_empty_with_index_pass_dtype(all_parsers):
4648
parser = all_parsers
4749

@@ -56,6 +58,7 @@ def test_empty_with_index_pass_dtype(all_parsers):
5658
tm.assert_frame_equal(result, expected)
5759

5860

61+
@xfail_pyarrow # CSV parse error: Empty CSV file or block
5962
def test_empty_with_multi_index_pass_dtype(all_parsers):
6063
parser = all_parsers
6164

@@ -72,6 +75,7 @@ def test_empty_with_multi_index_pass_dtype(all_parsers):
7275
tm.assert_frame_equal(result, expected)
7376

7477

78+
@xfail_pyarrow # CSV parse error: Empty CSV file or block
7579
def test_empty_with_mangled_column_pass_dtype_by_names(all_parsers):
7680
parser = all_parsers
7781

@@ -84,6 +88,7 @@ def test_empty_with_mangled_column_pass_dtype_by_names(all_parsers):
8488
tm.assert_frame_equal(result, expected)
8589

8690

91+
@xfail_pyarrow # CSV parse error: Empty CSV file or block
8792
def test_empty_with_mangled_column_pass_dtype_by_indexes(all_parsers):
8893
parser = all_parsers
8994

@@ -96,6 +101,7 @@ def test_empty_with_mangled_column_pass_dtype_by_indexes(all_parsers):
96101
tm.assert_frame_equal(result, expected)
97102

98103

104+
@xfail_pyarrow # CSV parse error: Empty CSV file or block
99105
def test_empty_with_dup_column_pass_dtype_by_indexes(all_parsers):
100106
# see gh-9424
101107
parser = all_parsers
@@ -165,6 +171,7 @@ def test_empty_with_dup_column_pass_dtype_by_indexes_raises(all_parsers):
165171
),
166172
],
167173
)
174+
@xfail_pyarrow # CSV parse error: Empty CSV file or block
168175
def test_empty_dtype(all_parsers, dtype, expected):
169176
# see gh-14712
170177
parser = all_parsers

0 commit comments

Comments
 (0)