forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
110 lines (86 loc) · 3.15 KB
/
Copy pathconftest.py
File metadata and controls
110 lines (86 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from pytest import skip, mark
groups = [
'hdfs',
'parquet',
'plasma',
'large_memory',
's3',
]
defaults = {
'hdfs': False,
'large_memory': False,
'parquet': False,
'plasma': False,
'large_memory': False,
's3': False,
}
try:
import pyarrow.parquet # noqa
defaults['parquet'] = True
except ImportError:
pass
try:
import pyarrow.plasma as plasma # noqa
defaults['plasma'] = True
except ImportError:
pass
def pytest_configure(config):
pass
def pytest_addoption(parser):
for group in groups:
parser.addoption('--{0}'.format(group), action='store_true',
default=defaults[group],
help=('Enable the {0} test group'.format(group)))
for group in groups:
parser.addoption('--disable-{0}'.format(group), action='store_true',
default=False,
help=('Disable the {0} test group'.format(group)))
for group in groups:
parser.addoption('--only-{0}'.format(group), action='store_true',
default=False,
help=('Run only the {0} test group'.format(group)))
parser.addoption('--runslow', action='store_true',
default=False, help='run slow tests')
def pytest_collection_modifyitems(config, items):
if not config.getoption('--runslow'):
skip_slow = mark.skip(reason='need --runslow option to run')
for item in items:
if 'slow' in item.keywords:
item.add_marker(skip_slow)
def pytest_runtest_setup(item):
only_set = False
for group in groups:
only_flag = '--only-{0}'.format(group)
disable_flag = '--disable-{0}'.format(group)
flag = '--{0}'.format(group)
if item.config.getoption(only_flag):
only_set = True
elif getattr(item.obj, group, None):
if (item.config.getoption(disable_flag) or
not item.config.getoption(flag)):
skip('{0} NOT enabled'.format(flag))
if only_set:
skip_item = True
for group in groups:
only_flag = '--only-{0}'.format(group)
if (getattr(item.obj, group, False) and
item.config.getoption(only_flag)):
skip_item = False
if skip_item:
skip('Only running some groups with only flags')