forked from AllenInstitute/AllenSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
40 lines (29 loc) · 1.27 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
import os
import matplotlib
matplotlib.use('agg')
import pytest # noqa: E402
from allensdk.test_utilities.temp_dir import temp_dir # noqa: E402
@pytest.fixture(scope="function")
def fn_temp_dir(request):
return temp_dir(request)
@pytest.fixture(scope="module")
def md_temp_dir(request):
return temp_dir(request)
def pytest_collection_modifyitems(config, items):
''' A pytest magic function. This function is called post-collection and gives us a hook for modifying the
collected items.
'''
skip_api_endpoint_test = pytest.mark.skipif(
'TEST_API_ENDPOINT' not in os.environ,
reason='this test requires that an API endpoint be specified (set the TEST_API_ENDPOINT environment variable).'
)
skip_nightly_test = pytest.mark.skipif(
os.getenv('TEST_COMPLETE') != 'true',
reason='this test is either time/memory/compute expensive or it depends on resources internal to the Allen Institute. '\
'Either way, it does\'nt run by default and must be opted into (it does run in our nightly builds).'
)
for item in items:
if 'requires_api_endpoint' in item.keywords:
item.add_marker(skip_api_endpoint_test)
if 'nightly' in item.keywords:
item.add_marker(skip_nightly_test)