Merge pull request #759 from bnavigator/setuptools-update · python-control/python-control@d4c1f14
@@ -8,7 +8,6 @@
88from math import pi, log10
991010import matplotlib.pyplot as plt
11-from matplotlib.testing.decorators import cleanup as mplcleanup
1211import numpy as np
1312import pytest
1413@@ -18,7 +17,6 @@
1817@pytest.mark.usefixtures("editsdefaults") # makes sure to reset the defaults
1918# to the test configuration
2019class TestConfig:
21-2220# Create a simple second order system to use for testing
2321sys = ct.tf([10], [1, 2, 1])
2422@@ -28,8 +26,7 @@ def test_set_defaults(self):
2826assert ct.config.defaults['freqplot.deg'] == 2
2927assert ct.config.defaults['freqplot.Hz'] is None
302831-@mplcleanup
32-def test_get_param(self):
29+def test_get_param(self, mplcleanup):
3330assert ct.config._get_param('freqplot', 'dB')\
3431== ct.config.defaults['freqplot.dB']
3532assert ct.config._get_param('freqplot', 'dB', 1) == 1
@@ -92,8 +89,7 @@ def test_default_deprecation(self):
9289assert ct.config.defaults['bode.Hz'] \
9390== ct.config.defaults['freqplot.Hz']
949195-@mplcleanup
96-def test_fbs_bode(self):
92+def test_fbs_bode(self, mplcleanup):
9793ct.use_fbs_defaults()
98949995# Generate a Bode plot
@@ -137,8 +133,7 @@ def test_fbs_bode(self):
137133phase_x, phase_y = (((plt.gcf().axes[1]).get_lines())[0]).get_data()
138134np.testing.assert_almost_equal(phase_y[-1], -pi, decimal=2)
139135140-@mplcleanup
141-def test_matlab_bode(self):
136+def test_matlab_bode(self, mplcleanup):
142137ct.use_matlab_defaults()
143138144139# Generate a Bode plot
@@ -182,8 +177,7 @@ def test_matlab_bode(self):
182177phase_x, phase_y = (((plt.gcf().axes[1]).get_lines())[0]).get_data()
183178np.testing.assert_almost_equal(phase_y[-1], -pi, decimal=2)
184179185-@mplcleanup
186-def test_custom_bode_default(self):
180+def test_custom_bode_default(self, mplcleanup):
187181ct.config.defaults['freqplot.dB'] = True
188182ct.config.defaults['freqplot.deg'] = True
189183ct.config.defaults['freqplot.Hz'] = True
@@ -204,8 +198,7 @@ def test_custom_bode_default(self):
204198np.testing.assert_almost_equal(mag_y[0], 20*log10(10), decimal=3)
205199np.testing.assert_almost_equal(phase_y[-1], -pi, decimal=2)
206200207-@mplcleanup
208-def test_bode_number_of_samples(self):
201+def test_bode_number_of_samples(self, mplcleanup):
209202# Set the number of samples (default is 50, from np.logspace)
210203mag_ret, phase_ret, omega_ret = ct.bode_plot(self.sys, omega_num=87)
211204assert len(mag_ret) == 87
@@ -219,8 +212,7 @@ def test_bode_number_of_samples(self):
219212mag_ret, phase_ret, omega_ret = ct.bode_plot(self.sys, omega_num=87)
220213assert len(mag_ret) == 87
221214222-@mplcleanup
223-def test_bode_feature_periphery_decade(self):
215+def test_bode_feature_periphery_decade(self, mplcleanup):
224216# Generate a sample Bode plot to figure out the range it uses
225217ct.reset_defaults() # Make sure starting state is correct
226218mag_ret, phase_ret, omega_ret = ct.bode_plot(self.sys, Hz=False)