forked from scikit-learn-contrib/scikit-learn-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
39 lines (32 loc) · 1.14 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
import sys
from distutils.version import LooseVersion
import sklearn
import pytest
from _pytest.doctest import DoctestItem
def pytest_collection_modifyitems(config, items):
# numpy changed the str/repr formatting of numpy arrays in 1.14. We want to
# run doctests only for numpy >= 1.14.
skip_doctests = False
try:
import numpy as np
if LooseVersion(np.__version__) < LooseVersion("1.14") or LooseVersion(
sklearn.__version__
) < LooseVersion("0.23.0"):
reason = (
"doctests are only run for numpy >= 1.14 "
"and scikit-learn >=0.23.0"
)
skip_doctests = True
elif sys.platform.startswith("win32"):
reason = (
"doctests are not run for Windows because numpy arrays "
"repr is inconsistent across platforms."
)
skip_doctests = True
except ImportError:
pass
if skip_doctests:
skip_marker = pytest.mark.skip(reason=reason)
for item in items:
if isinstance(item, DoctestItem):
item.add_marker(skip_marker)