69
69
DF = DataFrame ({"a" : [1 , 2 , 3 ], "b" : [0.0 , 0.0 , 0.0 ]})
70
70
CWD = os .path .split (os .path .abspath (__file__ ))[0 ]
71
71
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" )
77
92
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
78
93
def test_orc ():
79
94
with ensure_clean () as path :
80
95
check (assert_type (DF .to_orc (path ), None ), type (None ))
81
96
check (assert_type (read_orc (path ), DataFrame ), DataFrame )
82
97
83
98
99
+ @pytest .mark .skipif (NO_PYARROW , reason = "pyarrow not available on 3.11 yet" )
84
100
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
85
101
def test_orc_path ():
86
102
with ensure_clean () as path :
@@ -89,6 +105,7 @@ def test_orc_path():
89
105
check (assert_type (read_orc (pathlib_path ), DataFrame ), DataFrame )
90
106
91
107
108
+ @pytest .mark .skipif (NO_PYARROW , reason = "pyarrow not available on 3.11 yet" )
92
109
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
93
110
def test_orc_buffer ():
94
111
with ensure_clean () as path :
@@ -101,18 +118,21 @@ def test_orc_buffer():
101
118
file_r .close ()
102
119
103
120
121
+ @pytest .mark .skipif (NO_PYARROW , reason = "pyarrow not available on 3.11 yet" )
104
122
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
105
123
def test_orc_columns ():
106
124
with ensure_clean () as path :
107
125
check (assert_type (DF .to_orc (path , index = False ), None ), type (None ))
108
126
check (assert_type (read_orc (path , columns = ["a" ]), DataFrame ), DataFrame )
109
127
110
128
129
+ @pytest .mark .skipif (NO_PYARROW , reason = "pyarrow not available on 3.11 yet" )
111
130
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
112
131
def test_orc_bytes ():
113
132
check (assert_type (DF .to_orc (index = False ), bytes ), bytes )
114
133
115
134
135
+ @pytest .mark .skipif (NO_LXML , reason = "lxml not available on 3.11 yet" )
116
136
def test_xml ():
117
137
with ensure_clean () as path :
118
138
check (assert_type (DF .to_xml (path ), None ), type (None ))
@@ -121,6 +141,7 @@ def test_xml():
121
141
check (assert_type (read_xml (f ), DataFrame ), DataFrame )
122
142
123
143
144
+ @pytest .mark .skipif (NO_LXML , reason = "lxml not available on 3.11 yet" )
124
145
def test_xml_str ():
125
146
with ensure_clean () as path :
126
147
check (assert_type (DF .to_xml (), str ), str )
@@ -287,12 +308,14 @@ def test_sas_xport() -> None:
287
308
pass
288
309
289
310
311
+ @pytest .mark .skipif (NO_PYTABLES , reason = "pytables not available on 3.11 yet" )
290
312
def test_hdf ():
291
313
with ensure_clean () as path :
292
314
check (assert_type (DF .to_hdf (path , "df" ), None ), type (None ))
293
315
check (assert_type (read_hdf (path ), Union [DataFrame , Series ]), DataFrame )
294
316
295
317
318
+ @pytest .mark .skipif (NO_PYTABLES , reason = "pytables not available on 3.11 yet" )
296
319
def test_hdfstore ():
297
320
with ensure_clean () as path :
298
321
store = HDFStore (path , model = "w" )
@@ -334,6 +357,7 @@ def test_hdfstore():
334
357
store .close ()
335
358
336
359
360
+ @pytest .mark .skipif (NO_PYTABLES , reason = "pytables not available on 3.11 yet" )
337
361
def test_read_hdf_iterator ():
338
362
with ensure_clean () as path :
339
363
check (assert_type (DF .to_hdf (path , "df" , format = "table" ), None ), type (None ))
@@ -348,6 +372,7 @@ def test_read_hdf_iterator():
348
372
ti .close ()
349
373
350
374
375
+ @pytest .mark .skipif (NO_PYTABLES , reason = "pytables not available on 3.11 yet" )
351
376
def test_hdf_context_manager ():
352
377
with ensure_clean () as path :
353
378
check (assert_type (DF .to_hdf (path , "df" , format = "table" ), None ), type (None ))
@@ -356,6 +381,7 @@ def test_hdf_context_manager():
356
381
check (assert_type (store .get ("df" ), Union [DataFrame , Series ]), DataFrame )
357
382
358
383
384
+ @pytest .mark .skipif (NO_PYTABLES , reason = "pytables not available on 3.11 yet" )
359
385
def test_hdf_series ():
360
386
s = DF ["a" ]
361
387
with ensure_clean () as path :
@@ -397,13 +423,15 @@ def test_json_chunk():
397
423
check (assert_type (DF .to_json (), str ), str )
398
424
399
425
426
+ @pytest .mark .skipif (NO_PYARROW , reason = "pyarrow not available on 3.11 yet" )
400
427
def test_parquet ():
401
428
with ensure_clean () as path :
402
429
check (assert_type (DF .to_parquet (path ), None ), type (None ))
403
430
check (assert_type (read_parquet (path ), DataFrame ), DataFrame )
404
431
check (assert_type (DF .to_parquet (), bytes ), bytes )
405
432
406
433
434
+ @pytest .mark .skipif (NO_PYARROW , reason = "pyarrow not available on 3.11 yet" )
407
435
def test_parquet_options ():
408
436
with ensure_clean (".parquet" ) as path :
409
437
check (
@@ -413,6 +441,7 @@ def test_parquet_options():
413
441
check (assert_type (read_parquet (path ), DataFrame ), DataFrame )
414
442
415
443
444
+ @pytest .mark .skipif (NO_PYARROW , reason = "pyarrow not available on 3.11 yet" )
416
445
def test_feather ():
417
446
with ensure_clean () as path :
418
447
check (assert_type (DF .to_feather (path ), None ), type (None ))
@@ -800,6 +829,7 @@ def test_read_sql_query_generator():
800
829
con .close ()
801
830
802
831
832
+ @pytest .mark .skipif (NO_PYARROW , reason = "pyarrow not available on 3.11 yet" )
803
833
def test_read_html ():
804
834
check (assert_type (DF .to_html (), str ), str )
805
835
with ensure_clean () as path :
0 commit comments