Skip to content

Commit 9db91cf

Browse files
committed
revert rerunfailures, replace mplcleanup decorator with our fixture
1 parent 5336c65 commit 9db91cf

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

.github/conda-env/test-env.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ dependencies:
66
- pytest
77
- pytest-cov
88
- pytest-timeout
9-
- pytest-rerunfailures
109
- numpy
1110
- matplotlib
1211
- scipy

control/tests/config_test.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from math import pi, log10
99

1010
import matplotlib.pyplot as plt
11-
from matplotlib.testing.decorators import cleanup as mplcleanup
1211
import numpy as np
1312
import pytest
1413

@@ -18,7 +17,6 @@
1817
@pytest.mark.usefixtures("editsdefaults") # makes sure to reset the defaults
1918
# to the test configuration
2019
class TestConfig:
21-
2220
# Create a simple second order system to use for testing
2321
sys = ct.tf([10], [1, 2, 1])
2422

@@ -28,8 +26,7 @@ def test_set_defaults(self):
2826
assert ct.config.defaults['freqplot.deg'] == 2
2927
assert ct.config.defaults['freqplot.Hz'] is None
3028

31-
@mplcleanup
32-
def test_get_param(self):
29+
def test_get_param(self, mplcleanup):
3330
assert ct.config._get_param('freqplot', 'dB')\
3431
== ct.config.defaults['freqplot.dB']
3532
assert ct.config._get_param('freqplot', 'dB', 1) == 1
@@ -92,8 +89,7 @@ def test_default_deprecation(self):
9289
assert ct.config.defaults['bode.Hz'] \
9390
== ct.config.defaults['freqplot.Hz']
9491

95-
@mplcleanup
96-
def test_fbs_bode(self):
92+
def test_fbs_bode(self, mplcleanup):
9793
ct.use_fbs_defaults()
9894

9995
# Generate a Bode plot
@@ -137,8 +133,7 @@ def test_fbs_bode(self):
137133
phase_x, phase_y = (((plt.gcf().axes[1]).get_lines())[0]).get_data()
138134
np.testing.assert_almost_equal(phase_y[-1], -pi, decimal=2)
139135

140-
@mplcleanup
141-
def test_matlab_bode(self):
136+
def test_matlab_bode(self, mplcleanup):
142137
ct.use_matlab_defaults()
143138

144139
# Generate a Bode plot
@@ -182,8 +177,7 @@ def test_matlab_bode(self):
182177
phase_x, phase_y = (((plt.gcf().axes[1]).get_lines())[0]).get_data()
183178
np.testing.assert_almost_equal(phase_y[-1], -pi, decimal=2)
184179

185-
@mplcleanup
186-
def test_custom_bode_default(self):
180+
def test_custom_bode_default(self, mplcleanup):
187181
ct.config.defaults['freqplot.dB'] = True
188182
ct.config.defaults['freqplot.deg'] = True
189183
ct.config.defaults['freqplot.Hz'] = True
@@ -204,8 +198,7 @@ def test_custom_bode_default(self):
204198
np.testing.assert_almost_equal(mag_y[0], 20*log10(10), decimal=3)
205199
np.testing.assert_almost_equal(phase_y[-1], -pi, decimal=2)
206200

207-
@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)
210203
mag_ret, phase_ret, omega_ret = ct.bode_plot(self.sys, omega_num=87)
211204
assert len(mag_ret) == 87
@@ -219,8 +212,7 @@ def test_bode_number_of_samples(self):
219212
mag_ret, phase_ret, omega_ret = ct.bode_plot(self.sys, omega_num=87)
220213
assert len(mag_ret) == 87
221214

222-
@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
225217
ct.reset_defaults() # Make sure starting state is correct
226218
mag_ret, phase_ret, omega_ret = ct.bode_plot(self.sys, Hz=False)

control/tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def editsdefaults():
105105

106106

107107
@pytest.fixture(scope="function")
108-
@pytest.mark.flaky(reruns=2, reruns_delay=1)
109108
def mplcleanup():
110109
"""Clean up any plots and changes a test may have made to matplotlib.
111110

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dynamic = ["version"]
4040
packages = ["control"]
4141

4242
[project.optional-dependencies]
43-
test = ["pytest", "pytest-timeout", "pytest-rerunfailures"]
43+
test = ["pytest", "pytest-timeout"]
4444
slycot = [ "slycot>=0.4.0" ]
4545
cvxopt = [ "cvxopt>=1.2.0" ]
4646

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy