Skip to content

Commit eb2b492

Browse files
author
Rory Yorke
committed
Replace test decorator cvxoptonly with pytest mark cvxopt
The pytest marker cvxopt is equivalent to the cvxoptonly decorator, and also allows cvxopt tests to be included or excluded at the pytest command-line.
1 parent 4be4767 commit eb2b492

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

control/tests/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ def pytest_runtest_setup(item):
1515
for mark in item.iter_markers())):
1616
pytest.skip("slycot not installed")
1717

18+
if (not control.exception.cvxopt_check()
19+
and any(mark.name == 'cvxopt'
20+
for mark in item.iter_markers())):
21+
pytest.skip("cvxopt not installed")
22+
1823

1924
@pytest.fixture(scope="session", autouse=True)
2025
def control_defaults():

control/tests/passivity_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
import pytest
66
import numpy
77
from control import ss, passivity, tf, sample_system, parallel, feedback
8-
from control.tests.conftest import cvxoptonly
98
from control.exception import ControlArgument, ControlDimension
109

11-
pytestmark = cvxoptonly
10+
pytestmark = pytest.mark.cvxopt
1211

1312

1413
def test_ispassive_ctime():

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[pytest]
22
markers =
33
slycot: tests needing slycot
4+
cvxopt: tests needing cvxopt

0 commit comments

Comments
 (0)