1
1
""" test orc compat """
2
2
import datetime
3
- import distutils
3
+ from decimal import Decimal
4
4
import os
5
5
6
6
import numpy as np
7
7
import pytest
8
8
9
- from pandas .compat import is_platform_windows
10
-
11
9
import pandas as pd
12
10
import pandas .util .testing as tm
13
11
14
12
from pandas .io .orc import PyArrowImpl , get_engine , read_orc
15
13
16
- try :
17
- import pyarrow # noqa
18
-
19
- if distutils .version .LooseVersion (pyarrow .__version__ ) < "0.13.0" :
20
- raise ImportError ("pyarrow must be >= 0.13.0 for read_orc" )
21
-
22
- _HAVE_PYARROW = True
23
- except ImportError :
24
- _HAVE_PYARROW = False
14
+ pyarrow = pytest .importorskip ("pyarrow" )
25
15
26
16
pytestmark = pytest .mark .filterwarnings (
27
17
"ignore:RangeIndex.* is deprecated:DeprecationWarning"
@@ -33,16 +23,7 @@ def dirpath(datapath):
33
23
return datapath ("io" , "data" , "orc" )
34
24
35
25
36
- @pytest .fixture
37
- def pa ():
38
- if not _HAVE_PYARROW :
39
- pytest .skip ("pyarrow is not installed" )
40
- if is_platform_windows ():
41
- pytest .skip ("pyarrow orc not available by default on windows" )
42
- return "pyarrow"
43
-
44
-
45
- def test_options_get_engine (pa ):
26
+ def test_options_get_engine ():
46
27
assert isinstance (get_engine ("pyarrow" ), PyArrowImpl )
47
28
48
29
with pd .option_context ("io.orc.engine" , "pyarrow" ):
@@ -61,7 +42,7 @@ def test_invalid_engine(dirpath):
61
42
read_orc (inputfile , engine = engine , columns = ["boolean1" ])
62
43
63
44
64
- def test_orc_reader_empty (dirpath , pa ):
45
+ def test_orc_reader_empty (dirpath ):
65
46
columns = [
66
47
"boolean1" ,
67
48
"byte1" ,
@@ -94,7 +75,7 @@ def test_orc_reader_empty(dirpath, pa):
94
75
tm .assert_equal (expected , got )
95
76
96
77
97
- def test_orc_reader_basic (dirpath , pa ):
78
+ def test_orc_reader_basic (dirpath ):
98
79
data = {
99
80
"boolean1" : np .array ([False , True ], dtype = "bool" ),
100
81
"byte1" : np .array ([1 , 100 ], dtype = "int8" ),
@@ -114,8 +95,7 @@ def test_orc_reader_basic(dirpath, pa):
114
95
tm .assert_equal (expected , got )
115
96
116
97
117
- def test_orc_reader_decimal (dirpath , pa ):
118
- from decimal import Decimal
98
+ def test_orc_reader_decimal (dirpath ):
119
99
120
100
# Only testing the first 10 rows of data
121
101
data = {
@@ -143,7 +123,7 @@ def test_orc_reader_decimal(dirpath, pa):
143
123
tm .assert_equal (expected , got )
144
124
145
125
146
- def test_orc_reader_date_low (dirpath , pa ):
126
+ def test_orc_reader_date_low (dirpath ):
147
127
data = {
148
128
"time" : np .array (
149
129
[
@@ -184,7 +164,7 @@ def test_orc_reader_date_low(dirpath, pa):
184
164
tm .assert_equal (expected , got )
185
165
186
166
187
- def test_orc_reader_date_high (dirpath , pa ):
167
+ def test_orc_reader_date_high (dirpath ):
188
168
data = {
189
169
"time" : np .array (
190
170
[
@@ -225,7 +205,7 @@ def test_orc_reader_date_high(dirpath, pa):
225
205
tm .assert_equal (expected , got )
226
206
227
207
228
- def test_orc_reader_snappy_compressed (dirpath , pa ):
208
+ def test_orc_reader_snappy_compressed (dirpath ):
229
209
data = {
230
210
"int1" : np .array (
231
211
[
0 commit comments