##// END OF EJS Templates
Make sure it exited quickly.
Itamar Turner-Trauring -
Show More
@@ -116,7 +116,6 b' class SubProcessTestCase(tt.TempFileMixin):'
116 116 subprocess is interrupted.
117 117 """
118 118 if threading.main_thread() != threading.current_thread():
119 raise RuntimeEror("Not in main thread")
120 119 raise nt.SkipTest("Can't run this test if not in main thread.")
121 120
122 121 def interrupt():
@@ -125,14 +124,19 b' class SubProcessTestCase(tt.TempFileMixin):'
125 124 interrupt_main()
126 125
127 126 threading.Thread(target=interrupt).start()
127 start = time.time()
128 128 try:
129 129 status = system('%s -c "import time; time.sleep(5)"' % python)
130 130 except KeyboardInterrupt:
131 131 # Success!
132 132 return
133 end = time.time()
133 134 self.assertNotEqual(
134 135 status, 0, "The process wasn't interrupted. Status: %s" % (status,)
135 136 )
137 self.assertTrue(
138 end - start < 2, "Process didn't die quickly: %s" % (end - start)
139 )
136 140
137 141 def test_getoutput(self):
138 142 out = getoutput('%s "%s"' % (python, self.fname))
General Comments 0
You need to be logged in to leave comments. Login now