Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions control/tests/rlocus_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@ def test_rlocus_default_wn(self):
[-1e-2, 1-1e7j, 1+1e7j], [0, -1e7j, 1e7j], 1))

# Set up a timer to catch execution time
def signal_handler(signum, frame):
raise Exception("rlocus took too long to complete")
signal.signal(signal.SIGALRM, signal_handler)

# Run the command and reset the alarm
signal.alarm(2) # 2 second timeout
ct.root_locus(sys)
signal.alarm(0) # reset the alarm
try:
def signal_handler(signum, frame):
raise Exception("rlocus took too long to complete")
signal.signal(signal.SIGALRM, signal_handler)

# Run the command and reset the alarm
signal.alarm(2) # 2 second timeout
ct.root_locus(sys)
signal.alarm(0) # reset the alarm

except AttributeError:
# If no SIGALRM (eg, on Windows), then skip this test
pass