Skip to content

Commit f6d51d6

Browse files
committed
skip 3.11 optional tests
1 parent 0fb3aad commit f6d51d6

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

tests/test_io.py

+35-5
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,34 @@
6969
DF = DataFrame({"a": [1, 2, 3], "b": [0.0, 0.0, 0.0]})
7070
CWD = os.path.split(os.path.abspath(__file__))[0]
7171

72-
73-
if sys.version_info >= (3, 11):
74-
# This is only needed temporarily due to no wheels being available for arrow on 3.11
75-
_arrow = pytest.importorskip("arrow")
76-
72+
try:
73+
import pyarrow
74+
NO_PYARROW = False
75+
except ImportError:
76+
NO_PYARROW = True
77+
78+
try:
79+
import pytables
80+
NO_PYTABLES = False
81+
except ImportError:
82+
NO_PYTABLES = True
83+
84+
try:
85+
import lxml
86+
NO_LXML = False
87+
except ImportError:
88+
NO_LXML = True
89+
90+
91+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
7792
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
7893
def test_orc():
7994
with ensure_clean() as path:
8095
check(assert_type(DF.to_orc(path), None), type(None))
8196
check(assert_type(read_orc(path), DataFrame), DataFrame)
8297

8398

99+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
84100
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
85101
def test_orc_path():
86102
with ensure_clean() as path:
@@ -89,6 +105,7 @@ def test_orc_path():
89105
check(assert_type(read_orc(pathlib_path), DataFrame), DataFrame)
90106

91107

108+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
92109
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
93110
def test_orc_buffer():
94111
with ensure_clean() as path:
@@ -101,18 +118,21 @@ def test_orc_buffer():
101118
file_r.close()
102119

103120

121+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
104122
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
105123
def test_orc_columns():
106124
with ensure_clean() as path:
107125
check(assert_type(DF.to_orc(path, index=False), None), type(None))
108126
check(assert_type(read_orc(path, columns=["a"]), DataFrame), DataFrame)
109127

110128

129+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
111130
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
112131
def test_orc_bytes():
113132
check(assert_type(DF.to_orc(index=False), bytes), bytes)
114133

115134

135+
@pytest.mark.skipif(NO_LXML, reason="lxml not available on 3.11 yet")
116136
def test_xml():
117137
with ensure_clean() as path:
118138
check(assert_type(DF.to_xml(path), None), type(None))
@@ -121,6 +141,7 @@ def test_xml():
121141
check(assert_type(read_xml(f), DataFrame), DataFrame)
122142

123143

144+
@pytest.mark.skipif(NO_LXML, reason="lxml not available on 3.11 yet")
124145
def test_xml_str():
125146
with ensure_clean() as path:
126147
check(assert_type(DF.to_xml(), str), str)
@@ -287,12 +308,14 @@ def test_sas_xport() -> None:
287308
pass
288309

289310

311+
@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
290312
def test_hdf():
291313
with ensure_clean() as path:
292314
check(assert_type(DF.to_hdf(path, "df"), None), type(None))
293315
check(assert_type(read_hdf(path), Union[DataFrame, Series]), DataFrame)
294316

295317

318+
@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
296319
def test_hdfstore():
297320
with ensure_clean() as path:
298321
store = HDFStore(path, model="w")
@@ -334,6 +357,7 @@ def test_hdfstore():
334357
store.close()
335358

336359

360+
@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
337361
def test_read_hdf_iterator():
338362
with ensure_clean() as path:
339363
check(assert_type(DF.to_hdf(path, "df", format="table"), None), type(None))
@@ -348,6 +372,7 @@ def test_read_hdf_iterator():
348372
ti.close()
349373

350374

375+
@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
351376
def test_hdf_context_manager():
352377
with ensure_clean() as path:
353378
check(assert_type(DF.to_hdf(path, "df", format="table"), None), type(None))
@@ -356,6 +381,7 @@ def test_hdf_context_manager():
356381
check(assert_type(store.get("df"), Union[DataFrame, Series]), DataFrame)
357382

358383

384+
@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
359385
def test_hdf_series():
360386
s = DF["a"]
361387
with ensure_clean() as path:
@@ -397,13 +423,15 @@ def test_json_chunk():
397423
check(assert_type(DF.to_json(), str), str)
398424

399425

426+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
400427
def test_parquet():
401428
with ensure_clean() as path:
402429
check(assert_type(DF.to_parquet(path), None), type(None))
403430
check(assert_type(read_parquet(path), DataFrame), DataFrame)
404431
check(assert_type(DF.to_parquet(), bytes), bytes)
405432

406433

434+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
407435
def test_parquet_options():
408436
with ensure_clean(".parquet") as path:
409437
check(
@@ -413,6 +441,7 @@ def test_parquet_options():
413441
check(assert_type(read_parquet(path), DataFrame), DataFrame)
414442

415443

444+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
416445
def test_feather():
417446
with ensure_clean() as path:
418447
check(assert_type(DF.to_feather(path), None), type(None))
@@ -800,6 +829,7 @@ def test_read_sql_query_generator():
800829
con.close()
801830

802831

832+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
803833
def test_read_html():
804834
check(assert_type(DF.to_html(), str), str)
805835
with ensure_clean() as path:

0 commit comments

Comments
 (0)