forked from readthedocs/readthedocs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
46 lines (37 loc) · 1.29 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
# -*- coding: utf-8 -*-
import pytest
try:
# TODO: this file is read/executed even when called from ``readthedocsinc``,
# so it's overriding the options that we are defining in the ``conftest.py``
# from the corporate site. We need to find a better way to avoid this.
import readthedocsinc
PYTEST_OPTIONS = ()
except ImportError:
PYTEST_OPTIONS = (
# Options to set test environment
('community', True),
('corporate', False),
('environment', 'readthedocs'),
('url_scheme', 'http'),
)
def pytest_addoption(parser):
parser.addoption(
'--including-search',
action='store_true',
dest='searchtests',
default=False, help='enable search tests',
)
def pytest_configure(config):
if not config.option.searchtests:
# Include ``not search``` to parameters so search tests do not perform
markexpr = getattr(config.option, 'markexpr')
if markexpr:
markexpr += ' and not search'
else:
markexpr = 'not search'
setattr(config.option, 'markexpr', markexpr.strip())
for option, value in PYTEST_OPTIONS:
setattr(config.option, option, value)
@pytest.fixture(autouse=True)
def settings_modification(settings):
settings.CELERY_ALWAYS_EAGER = True