Skip to content

Commit 71101bf

Browse files
authored
Merge pull request #232 from murrayrm/fix-statesp_test-warnings
Fix numpy generated warnings that are breaking unit tests
2 parents a007fcc + 53e0a09 commit 71101bf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

control/tests/freqresp_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ def test_discrete(self):
141141
import warnings
142142
warnings.simplefilter('always', UserWarning) # don't supress
143143
with warnings.catch_warnings(record=True) as w:
144+
# Set up warnings filter to only show warnings in control module
145+
warnings.filterwarnings("ignore")
146+
warnings.filterwarnings("always", module="control")
147+
148+
# Look for a warning about sampling above Nyquist frequency
144149
omega_bad = np.linspace(10e-4,1.1,10) * np.pi/sys.dt
145150
ret = sys.freqresp(omega_bad)
146151
print("len(w) =", len(w))

control/tests/statesp_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ def testEvalFr(self):
148148
# Deprecated version of the call (should generate warning)
149149
import warnings
150150
with warnings.catch_warnings(record=True) as w:
151-
warnings.simplefilter("always")
151+
# Set up warnings filter to only show warnings in control module
152+
warnings.filterwarnings("ignore")
153+
warnings.filterwarnings("always", module="control")
154+
155+
# Make sure that we get a pending deprecation warning
152156
sys.evalfr(1.)
153157
assert len(w) == 1
154158
assert issubclass(w[-1].category, PendingDeprecationWarning)

0 commit comments

Comments
 (0)