Skip to content

Commit 6454b04

Browse files
author
Rory Yorke
committed
Add pytest marker pandas for tests requiring pandas
1 parent 5ee1a56 commit 6454b04

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

control/tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ def pytest_runtest_setup(item):
2020
for mark in item.iter_markers())):
2121
pytest.skip("cvxopt not installed")
2222

23+
if (not control.exception.pandas_check()
24+
and any(mark.name == 'pandas'
25+
for mark in item.iter_markers())):
26+
pytest.skip("pandas not installed")
27+
28+
2329

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

control/tests/frd_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from control.xferfcn import TransferFunction
1313
from control.frdata import frd, _convert_to_frd, FrequencyResponseData
1414
from control import bdalg, freqplot
15-
from control.exception import pandas_check
1615

1716

1817
class TestFRD:
@@ -820,7 +819,7 @@ def test_named_signals():
820819
assert f1.output_labels == ['y0']
821820

822821

823-
@pytest.mark.skipif(not pandas_check(), reason="pandas not installed")
822+
@pytest.mark.pandas
824823
def test_to_pandas():
825824
# Create a SISO frequency response
826825
h1 = TransferFunction([1], [1, 2, 2])

control/tests/timeresp_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ def test_response_transpose(
12351235
assert x.shape == (T.size, sys.nstates)
12361236

12371237

1238-
@pytest.mark.skipif(not pandas_check(), reason="pandas not installed")
1238+
@pytest.mark.pandas
12391239
def test_to_pandas():
12401240
# Create a SISO time response
12411241
sys = ct.rss(2, 1, 1)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ filterwarnings = [
5858
markers = [
5959
"slycot: tests needing slycot",
6060
"cvxopt: tests needing cvxopt",
61+
"pandas: tests needing pandas",
6162
]
6263

6364

0 commit comments

Comments
 (0)