comparison upreckon/testcases.py @ 218:65b5c9390010

With _unix, Escape presses now cancel test data unarchiving
author Oleg Oshmyan <chortos@inbox.lv>
date Mon, 22 Aug 2011 22:34:09 +0300
parents ce1285728952
children f94f9724c543
comparison
equal deleted inserted replaced
217:ce1285728952 218:65b5c9390010
17 17
18 class DummySignalIgnorer(object): 18 class DummySignalIgnorer(object):
19 def __enter__(self): pass 19 def __enter__(self): pass
20 def __exit__(self, exc_type, exc_value, traceback): pass 20 def __exit__(self, exc_type, exc_value, traceback): pass
21 signal_ignorer = DummySignalIgnorer() 21 signal_ignorer = DummySignalIgnorer()
22 def install_escape_handler(): pass
23 def remove_escape_handler(): pass
22 24
23 try: 25 try:
24 from .win32 import * 26 from .win32 import *
25 except Exception: 27 except Exception:
26 from .unix import * 28 from .unix import *
119 def __call__(case, callback): 121 def __call__(case, callback):
120 case.has_called_back = False 122 case.has_called_back = False
121 case.files_to_delete = [] 123 case.files_to_delete = []
122 case.time_limit_string = case.wall_time_limit_string 124 case.time_limit_string = case.wall_time_limit_string
123 try: 125 try:
126 install_escape_handler()
124 return case.test(callback) 127 return case.test(callback)
125 finally: 128 finally:
129 remove_escape_handler()
126 now = clock() 130 now = clock()
127 if getattr(case, 'time_started', None) is None: 131 if getattr(case, 'time_started', None) is None:
128 case.time_started = case.time_stopped = now 132 case.time_started = case.time_stopped = now
129 elif getattr(case, 'time_stopped', None) is None: 133 elif getattr(case, 'time_stopped', None) is None:
130 case.time_stopped = now 134 case.time_stopped = now