def setUpClass(cls):
cls.__lockup_timestamp__ = time.time()
def check_twisted():
while time.time() - cls.__lockup_timestamp__ < cls.MAX_TEST_TIME:
time.sleep(2)
# If the test class completed normally, exit
if not cls.__testing__:
return
# If we made it here, there is a serious issue which we cannot recover from.
# Most likely the Twisted threadpool got into a deadlock while shutting down.
import os, traceback
print >> sys.stderr, "The test-suite locked up! Force quitting! Thread dump:"
for tid, stack in sys._current_frames().items():
if tid != threading.currentThread().ident:
print >> sys.stderr, "THREAD#%d" % tid
for line in traceback.format_list(traceback.extract_stack(stack)):
print >> sys.stderr, "|", line[:-1].replace('\n', '\n| ')
os._exit(1)
t = threading.Thread(target=check_twisted)
t.daemon = True
t.start()
评论列表
文章目录