-
Notifications
You must be signed in to change notification settings - Fork 76
/
conftest.py
117 lines (81 loc) · 3.05 KB
/
conftest.py
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
111
112
113
114
115
116
117
import os
import sys
from hypothesis import settings, Verbosity
import pytest
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
from sourmash_tst_utils import TempDirectory, RunnerContext
sys.stdout = sys.stderr
@pytest.fixture
def runtmp():
with TempDirectory() as location:
yield RunnerContext(location)
@pytest.fixture
def run():
yield RunnerContext(os.getcwd())
@pytest.fixture(params=[True, False])
def track_abundance(request):
return request.param
@pytest.fixture(params=[True, False])
def dayhoff(request):
return request.param
@pytest.fixture(params=[True, False])
def hp(request):
return request.param
@pytest.fixture(params=[True, False])
def keep_identifiers(request):
return request.param
@pytest.fixture(params=[True, False])
def keep_versions(request):
return request.param
@pytest.fixture(params=[2, 5, 10])
def n_children(request):
return request.param
@pytest.fixture(params=["--linear", "--no-linear"])
def linear_gather(request):
return request.param
@pytest.fixture(params=["--prefetch", "--no-prefetch"])
def prefetch_gather(request):
return request.param
@pytest.fixture(params=[True, False])
def use_manifest(request):
return request.param
@pytest.fixture(params=['json', 'sql'])
def lca_db_format(request):
return request.param
@pytest.fixture(params=['csv', 'sql'])
def manifest_db_format(request):
return request.param
@pytest.fixture(params=['sig', 'sig.gz', 'zip', '.d/', '.sqldb'])
def sig_save_extension(request):
return request.param
# --- BEGIN - Only run tests using a particular fixture --- #
# Cribbed from: http://pythontesting.net/framework/pytest/pytest-run-tests-using-particular-fixture/
def pytest_collection_modifyitems(items, config):
fixture_name = config.option.usesfixture
if fixture_name is not None:
selected_items = []
deselected_items = []
for item in items:
if fixture_name in getattr(item, 'fixturenames', ()):
selected_items.append(item)
else:
deselected_items.append(item)
config.hook.pytest_deselected(items=deselected_items)
items[:] = selected_items
# --- END - Only run tests using a particular fixture --- #
def pytest_addoption(parser):
parser.addoption("--usesfixture",
action="store",
default=None,
help="just run tests that use a particular fixture")
parser.addoption("--run-hypothesis", action="store_true",
help="run hypothesis tests")
def pytest_runtest_setup(item):
if item.config.getoption("--run-hypothesis"):
if not any(mark for mark in item.iter_markers(name="hypothesis")):
pytest.skip("--run-hypothesis option set, running only hypothesis tests")
settings.register_profile("ci", max_examples=1000)
settings.register_profile("dev", max_examples=10)
settings.register_profile("debug", max_examples=10, verbosity=Verbosity.verbose)
settings.load_profile(os.getenv(u'HYPOTHESIS_PROFILE', 'default'))