Skip to content

Commit cc02712

Browse files
committed
Attempt #2 at 397efab, based on linter recommendation
1 parent 397efab commit cc02712

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

control/tests/margin_test.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pytest
1212
from numpy import inf, nan
1313
from numpy.testing import assert_allclose
14+
import importlib
1415

1516
from control import ControlMIMONotImplemented, FrequencyResponseData, \
1617
StateSpace, TransferFunction, margin, phase_crossover_frequencies, \
@@ -403,9 +404,7 @@ def test_mimo_disk_margin():
403404
Lo = P*K # loop transfer function, broken at plant output
404405
Li = K*P # loop transfer function, broken at plant input
405406

406-
try:
407-
import slycot
408-
except ImportError:
407+
if importlib.util.find_spec('slycot') == None:
409408
with pytest.raises(ControlMIMONotImplemented,\
410409
match = "Need slycot to compute MIMO disk_margins"):
411410

@@ -461,9 +460,7 @@ def test_mimo_disk_margin_return_all():
461460
Lo = P*K # loop transfer function, broken at plant output
462461
Li = K*P # loop transfer function, broken at plant input
463462

464-
try:
465-
import slycot
466-
except ImportError:
463+
if importlib.util.find_spec('slycot') == None:
467464
with pytest.raises(ControlMIMONotImplemented,\
468465
match = "Need slycot to compute MIMO disk_margins"):
469466

0 commit comments

Comments
 (0)