##// END OF EJS Templates
Fix the signal handler that was breaking the test
Itamar Turner-Trauring -
Show More
@@ -15,6 +15,7 b' Tests for platutils.py'
15 15 #-----------------------------------------------------------------------------
16 16
17 17 import sys
18 import signal
18 19 import os
19 20 import time
20 21 from _thread import interrupt_main # Py 3
@@ -119,6 +120,11 b' class SubProcessTestCase(tt.TempFileMixin):'
119 120 if threading.main_thread() != threading.current_thread():
120 121 raise nt.SkipTest("Can't run this test if not in main thread.")
121 122
123 # Some tests can overwrite SIGINT handler (by using pdb for example),
124 # which then breaks this test, so just make sure it's operating
125 # normally.
126 signal.signal(signal.SIGINT, signal.default_int_handler)
127
122 128 def interrupt():
123 129 # Wait for subprocess to start:
124 130 time.sleep(0.5)
@@ -130,7 +136,7 b' class SubProcessTestCase(tt.TempFileMixin):'
130 136 result = command()
131 137 except KeyboardInterrupt:
132 138 # Success!
133 return
139 pass
134 140 end = time.time()
135 141 self.assertTrue(
136 142 end - start < 2, "Process didn't die quickly: %s" % (end - start)
General Comments 0
You need to be logged in to leave comments. Login now