Skip to content

Commit d83e67d

Browse files
committed
skip X11 tests if no DISPLAY env variable
1 parent 21e47a6 commit d83e67d

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

control/tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"PendingDeprecationWarning")
2727
matrixerrorfilter = pytest.mark.filterwarnings("error:.*matrix subclass:"
2828
"PendingDeprecationWarning")
29-
29+
X11only = pytest.mark.skipif(os.getenv("DISPLAY") is None,
30+
reason="requires X11")
3031

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

control/tests/rlocus_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from control.statesp import StateSpace
1414
from control.bdalg import feedback
1515

16+
from control.tests.conftest import X11only
17+
1618

1719
class TestRootLocus:
1820
"""These are tests for the feedback function in rlocus.py."""
@@ -48,6 +50,7 @@ def test_without_gains(self, sys):
4850
roots, kvect = root_locus(sys, plot=False)
4951
self.check_cl_poles(sys, roots, kvect)
5052

53+
@X11only
5154
def test_root_locus_zoom(self):
5255
"""Check the zooming functionality of the Root locus plot"""
5356
system = TransferFunction([1000], [1, 25, 100, 0])

control/tests/sisotool_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from control.rlocus import _RLClickDispatcher
1010
from control.xferfcn import TransferFunction
1111

12+
from control.tests.conftest import X11only
1213

1314
@pytest.mark.usefixtures("mplcleanup")
1415
class TestSisotool:
@@ -19,6 +20,7 @@ def sys(self):
1920
"""Return a generic SISO transfer function"""
2021
return TransferFunction([1000], [1, 25, 100, 0])
2122

23+
@X11only
2224
def test_sisotool(self, sys):
2325
sisotool(sys, Hz=False)
2426
fig = plt.gcf()

0 commit comments

Comments
 (0)