void-packages/srcpkgs/python3-cvxopt/patches/test-modules.patch

77 lines
2.4 KiB
Diff

diff --git a/tests/test_dsdp.py b/tests/test_dsdp.py
index d514dc8..2a5e5bf 100644
--- a/tests/test_dsdp.py
+++ b/tests/test_dsdp.py
@@ -4,9 +4,10 @@ class TestDSDP(unittest.TestCase):
def setUp(self):
try:
- from cvxopt import dsdp, matrix
- except:
+ import cvxopt.dsdp
+ except ModuleNotFoundError:
self.skipTest("DSDP not available")
+ from cvxopt import matrix
c = matrix([1.,-1.,1.])
G = [ matrix([[-7., -11., -11., 3.],
[ 7., -18., -18., 8.],
diff --git a/tests/test_glpk.py b/tests/test_glpk.py
index 89f876d..dad5801 100644
--- a/tests/test_glpk.py
+++ b/tests/test_glpk.py
@@ -4,15 +4,16 @@ class TestGLPK(unittest.TestCase):
def setUp(self):
try:
- from cvxopt import glpk, matrix
- c = matrix([-4., -5.])
- G = matrix([[2., 1., -1., 0.], [1., 2., 0., -1.]])
- h = matrix([3., 3., 0., 0.])
- A = matrix([1.0,1.0],(1,2))
- b = matrix(1.0)
- self._prob_data = (c,G,h,A,b)
- except:
+ import cvxopt.glpk
+ except ModuleNotFoundError:
self.skipTest("GLPK not available")
+ from cvxopt import matrix
+ c = matrix([-4., -5.])
+ G = matrix([[2., 1., -1., 0.], [1., 2., 0., -1.]])
+ h = matrix([3., 3., 0., 0.])
+ A = matrix([1.0,1.0],(1,2))
+ b = matrix(1.0)
+ self._prob_data = (c,G,h,A,b)
def test_lp(self):
from cvxopt import solvers, glpk
diff --git a/tests/test_gsl.py b/tests/test_gsl.py
index d24f058..3ee9a37 100644
--- a/tests/test_gsl.py
+++ b/tests/test_gsl.py
@@ -4,8 +4,8 @@ class TestGSL(unittest.TestCase):
def setUp(self):
try:
- from cvxopt import gsl
- except:
+ import cvxopt.gsl
+ except ModuleNotFoundError:
self.skipTest("GSL not available")
def test1(self):
diff --git a/tests/test_mosek.py b/tests/test_mosek.py
index e3d0f4e..6cd1fbf 100644
--- a/tests/test_mosek.py
+++ b/tests/test_mosek.py
@@ -4,8 +4,8 @@ class TestMOSEK(unittest.TestCase):
def setUp(self):
try:
- from cvxopt import msk
- except:
+ import cvxopt.msk
+ except ModuleNotFoundError:
self.skipTest("MOSEK not available")
def assertAlmostEqualLists(self,L1,L2,places=3):