Skip to content

Commit 583dbe4

Browse files
committed
ecos
1 parent fb24481 commit 583dbe4

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/test_efficient_frontier.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,10 @@ def test_efficient_risk_market_neutral_L2_reg():
10471047
)
10481048

10491049

1050+
@pytest.mark.skipif(
1051+
not _check_soft_dependencies(["ecos"], severity="none"),
1052+
reason="skip test if ecos is not installed in environment",
1053+
)
10501054
def test_efficient_risk_market_neutral_warning():
10511055
ef = setup_efficient_frontier(solver=cp.ECOS)
10521056
with pytest.warns(RuntimeWarning) as w:
@@ -1093,6 +1097,10 @@ def test_efficient_frontier_error():
10931097
EfficientFrontier(ef.expected_returns, 0.01)
10941098

10951099

1100+
@pytest.mark.skipif(
1101+
not _check_soft_dependencies(["ecos"], severity="none"),
1102+
reason="skip test if ecos is not installed in environment",
1103+
)
10961104
def test_efficient_return_many_values():
10971105
ef = setup_efficient_frontier(solver=cp.ECOS)
10981106
for target_return in np.arange(0.25, 0.28, 0.01):
@@ -1222,6 +1230,10 @@ def test_efficient_return_market_neutral_unbounded():
12221230
assert long_only_sharpe < sharpe
12231231

12241232

1233+
@pytest.mark.skipif(
1234+
not _check_soft_dependencies(["ecos"], severity="none"),
1235+
reason="skip test if ecos is not installed in environment",
1236+
)
12251237
def test_efficient_return_market_neutral_warning():
12261238
# This fails
12271239
ef = setup_efficient_frontier(solver=cp.ECOS)

tests/test_efficient_semivariance.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22
import pytest
33
from cvxpy.error import SolverError
4+
from skbase.utils.dependencies import _check_soft_dependencies
45

56
from pypfopt import (
67
EfficientFrontier,
@@ -176,6 +177,10 @@ def test_min_semivariance_extra_constraints():
176177
assert w["GOOG"] >= 0.025 and w["AAPL"] <= 0.035
177178

178179

180+
@pytest.mark.skipif(
181+
not _check_soft_dependencies(["ecos"], severity="none"),
182+
reason="skip test if ecos is not installed in environment",
183+
)
179184
def test_min_semivariance_different_solver():
180185
es = setup_efficient_semivariance(solver="ECOS")
181186
w = es.min_semivariance()
@@ -347,6 +352,10 @@ def test_max_quadratic_utility_with_shorts():
347352
)
348353

349354

355+
@pytest.mark.skipif(
356+
not _check_soft_dependencies(["ecos"], severity="none"),
357+
reason="skip test if ecos is not installed in environment",
358+
)
350359
def test_max_quadratic_utility_market_neutral():
351360
es = setup_efficient_semivariance(solver="ECOS", weight_bounds=(-1, 1))
352361
es.max_quadratic_utility(market_neutral=True)

0 commit comments

Comments
 (0)