[test] Try to protect some tests from a deprecated version of scikit learn
authorVincent Michel <vincent.michel@logilab.fr>
Mon, 26 Nov 2012 11:52:28 +0100
changeset 168 05d434a3c728
parent 167 826ef17747ea
child 169 2ca1f2b23577
[test] Try to protect some tests from a deprecated version of scikit learn
test/test_alignment.py
--- a/test/test_alignment.py	Mon Nov 26 11:35:47 2012 +0100
+++ b/test/test_alignment.py	Mon Nov 26 11:52:28 2012 +0100
@@ -304,6 +304,14 @@
                      ['T2', 'labelt2', (5.3, 48.2)],
                      ['T3', 'labelt3', (6.25, 48.91)],
                      ]
+        try:
+            import sklearn as skl
+        except:
+            print 'Scikit learn does not seem to be installed - Skipping test'
+            return
+        if int(skl.__version__.split('-')[0].split('.')[1])<11:
+            print 'Scikit learn version is too old - Skipping test'
+            return
         neighbours = alig.findneighbours_clustering(alignset, targetset, indexes=(2, 2))
         for neighbour in neighbours:
             self.assertIn(neighbour, [[[0, 1], [0, 2]], [[2, 3], [1]]])