Skip to content

Commit 6f572b2

Browse files
committed
Disable warning for pending deprecation of matrix throughout Orange
1 parent 1e732f4 commit 6f572b2

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Orange/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,10 @@
4646
pass
4747
finally:
4848
del ctypes
49+
50+
51+
# scipy.sparse uses matrix
52+
# we can't do anything about it, so we silence it until scipy is fixed
53+
import warnings
54+
warnings.filterwarnings(
55+
"ignore", ".*the matrix subclass.*", PendingDeprecationWarning)

Orange/tests/test_orange.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import unittest
2+
import warnings
3+
import os
4+
5+
import scipy.sparse as sp
26

37

48
class TestOrange(unittest.TestCase):
@@ -10,3 +14,16 @@ def test_orange_has_modules(self):
1014
for _, name, __ in pkgutil.iter_modules(Orange.__path__):
1115
if name not in unimported:
1216
self.assertIn(name, Orange.__dict__)
17+
18+
@unittest.skipUnless(
19+
os.environ.get("TRAVIS"),
20+
"Travis has latest versions; Appveyor doesn't, and users don't care")
21+
def test_remove_matrix_deprecation_filter(self):
22+
# Override filter in Orange.__init__
23+
warnings.filterwarnings(
24+
"once", ".*the matrix subclass.*", PendingDeprecationWarning)
25+
with self.assertWarns(
26+
PendingDeprecationWarning,
27+
msg="Remove filter for PendingDeprecationWarning of np.matrix "
28+
"from Orange.__init__"):
29+
sp.lil_matrix([1, 2, 3])

0 commit comments

Comments
 (0)