-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconftest.py
33 lines (27 loc) · 929 Bytes
/
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
import pytest
def pytest_report_header(config):
try:
import cms # noqa
cms_present = True
except ImportError:
cms_present = False
import django # noqa
django_version = int(django.__version__.split('.')[0])
if not cms_present:
return (
'WARNING: django-cms is not installed - some of the tests will '
'be skipped.')
elif cms_present and django_version > 1:
return (
'WARNING: your django version is incompatible with django-cms. '
'To use django-cms downgrade django to 1.11.')
def pytest_collection_modifyitems(config, items):
try:
import cms # noqa
return
except ImportError:
skip_cms_tests = pytest.mark.skip(
reason='django-cms is not installed')
for item in items:
if 'cms' in item.keywords:
item.add_marker(skip_cms_tests)