# Timeout management
class TimeoutException(Exception):
- """Execption raised when test timeout is reached."""
+ """Exception raised when test timeout is reached."""
#
def timeoutHandler(signum, frame):
raise TimeoutException()
# Set timeout handler
print "Test timeout explicitely set to: %s seconds"%timeout_delay
- signal.alarm(abs(int(timeout_delay)-10))
- signal.signal(signal.SIGALRM, timeoutHandler)
+ timeout_sec = abs(int(timeout_delay)-10)
+ if sys.platform == 'win32':
+ from threading import Timer
+ timer = Timer(timeout_sec, timeoutHandler)
+ timer.start()
+ else:
+ signal.alarm(timeout_sec)
+ signal.signal(signal.SIGALRM, timeoutHandler)
# Run test in a new SALOME instance
from salome_instance import SalomeInstance
pass
salome_instance.stop()
+ if sys.platform == 'win32':
+ timer.cancel()
print "Exit test with status code:", res
exit(res)
#