We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f777bb commit 61e0443Copy full SHA for 61e0443
1 file changed
tests/test_cla.py
@@ -155,13 +155,18 @@ def test_cla_efficient_frontier():
155
def test_cla_cvxcla_fallback_warning():
156
"""cvxcla unavailable → RuntimeWarning, falls back to standard backend."""
157
import sys
158
- import unittest.mock as mock
159
160
- # Simulate cvxcla not being installed
161
- with mock.patch.dict(sys.modules, {"cvxcla": None}):
+ original = sys.modules.get("cvxcla")
+ sys.modules["cvxcla"] = None
+ try:
162
with pytest.warns(RuntimeWarning, match="cvxcla is not installed"):
163
cla = setup_cla(use_cvxcla=True)
164
assert cla.use_cvxcla is False
165
+ finally:
166
+ if original is None:
167
+ sys.modules.pop("cvxcla", None)
168
+ else:
169
+ sys.modules["cvxcla"] = original
170
171
172
def test_cla_cvxcla_max_sharpe():
0 commit comments