8000 Merge pull request #5429 from amueller/python33_reload · scikit-learn/scikit-learn@6db9ee0 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 6db9ee0

Browse files
committed
Merge pull request #5429 from amueller/python33_reload
FIX skip LDA deprecation test on python3.3 that has no reload.
2 parents 9be4337 + 18a53f2 commit 6db9ee0

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

sklearn/tests/test_discriminant_analysis.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
try:
2-
# Python 2 compat
3-
reload
4-
except NameError:
5-
# Regular Python 3+ import
6-
from importlib import reload
1+
import sys
72
import numpy as np
3+
from nose import SkipTest
84

95
from sklearn.utils.testing import assert_array_equal
106
from sklearn.utils.testing import assert_array_almost_equal
@@ -22,6 +18,15 @@
2218
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
2319

2420

21+
# import reload
22+
version = sys.version_info
23+
if version[0] == 3:
24+
# Python 3+ import for reload. Builtin in Python2
25+
if version[1] == 3:
26+
reload = None
27+
from importlib import reload
28+
29+
2530
# Data is just 6 separable points in the plane
2631
X = np.array([[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1]], dtype='f')
2732
y = np.array([1, 1, 1, 2, 2, 2])
@@ -298,6 +303,9 @@ def test_qda_regularization():
298303

299304

300305
def test_deprecated_lda_qda_deprecation():
306+
if reload is None:
307+
SkipTest("Can't reload module on Python3.3")
308+
301309
def import_lda_module():
302310
import sklearn.lda
303311
# ensure that we trigger DeprecationWarning even if the sklearn.lda

0 commit comments

Comments
 (0)
0