Show More
@@ -15,6 +15,7 b' Tests for platutils.py' | |||||
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
17 | import sys |
|
17 | import sys | |
|
18 | import signal | |||
18 | import os |
|
19 | import os | |
19 | import time |
|
20 | import time | |
20 | from _thread import interrupt_main # Py 3 |
|
21 | from _thread import interrupt_main # Py 3 | |
@@ -119,6 +120,11 b' class SubProcessTestCase(tt.TempFileMixin):' | |||||
119 | if threading.main_thread() != threading.current_thread(): |
|
120 | if threading.main_thread() != threading.current_thread(): | |
120 | raise nt.SkipTest("Can't run this test if not in main thread.") |
|
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 | def interrupt(): |
|
128 | def interrupt(): | |
123 | # Wait for subprocess to start: |
|
129 | # Wait for subprocess to start: | |
124 | time.sleep(0.5) |
|
130 | time.sleep(0.5) | |
@@ -130,7 +136,7 b' class SubProcessTestCase(tt.TempFileMixin):' | |||||
130 | result = command() |
|
136 | result = command() | |
131 | except KeyboardInterrupt: |
|
137 | except KeyboardInterrupt: | |
132 | # Success! |
|
138 | # Success! | |
133 |
|
|
139 | pass | |
134 | end = time.time() |
|
140 | end = time.time() | |
135 | self.assertTrue( |
|
141 | self.assertTrue( | |
136 | end - start < 2, "Process didn't die quickly: %s" % (end - start) |
|
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