Skip to content

Commit 96c31f4

Browse files
committed
Don't call pyplot.show when examples are being tested.
1 parent cda981c commit 96c31f4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

examples/phaseplots.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# This file contains examples of phase portraits pulled from "Feedback
55
# Systems" by Astrom and Murray (Princeton University Press, 2008).
66

7+
import os
8+
79
import numpy as np
810
import matplotlib.pyplot as mpl
911
from control.phaseplot import phase_plot
@@ -120,4 +122,5 @@ def saddle_ode(x, t):
120122
mpl.xlabel('$x_1$'); mpl.ylabel('$x_2$');
121123
mpl.title('Undamped system\nLyapunov stable, not asympt. stable')
122124

123-
mpl.show()
125+
if 'PYCONTROL_TEST_EXAMPLES' not in os.environ():
126+
mpl.show()

examples/robust_siso.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
and Postlethwaite, 1st Edition.
55
"""
66

7+
import os
8+
79
import numpy as np
810
import matplotlib.pyplot as plt
911

@@ -99,4 +101,5 @@
99101
plt.legend()
100102
plt.title('Disturbance response')
101103

102-
plt.show()
104+
if 'PYCONTROL_TEST_EXAMPLES' not in os.environ():
105+
plt.show()

0 commit comments

Comments
 (0)