Skip to content

Commit 879217e

Browse files
committed
skip timeout test if SIGALRM is not defined
1 parent d75c395 commit 879217e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

control/tests/rlocus_test.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,17 @@ def test_rlocus_default_wn(self):
9595
[-1e-2, 1-1e7j, 1+1e7j], [0, -1e7j, 1e7j], 1))
9696

9797
# Set up a timer to catch execution time
98-
def signal_handler(signum, frame):
99-
raise Exception("rlocus took too long to complete")
100-
signal.signal(signal.SIGALRM, signal_handler)
101-
102-
# Run the command and reset the alarm
103-
signal.alarm(2) # 2 second timeout
104-
ct.root_locus(sys)
105-
signal.alarm(0) # reset the alarm
98+
try:
99+
def signal_handler(signum, frame):
100+
raise Exception("rlocus took too long to complete")
101+
signal.signal(signal.SIGALRM, signal_handler)
102+
103+
# Run the command and reset the alarm
104+
signal.alarm(2) # 2 second timeout
105+
ct.root_locus(sys)
106+
signal.alarm(0) # reset the alarm
107+
108+
except AttributeError:
109+
# If no SIGALRM (eg, on Windows), then skip this test
110+
pass
111+

0 commit comments

Comments
 (0)