From 1a716ed46d1d556d4ba6798608ab498320acd886 Mon Sep 17 00:00:00 2001 From: "Jeremy T. Bouse" Date: Sat, 25 May 2013 00:04:32 -0400 Subject: Imported Upstream version 1.10.1 --- test.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test.py') diff --git a/test.py b/test.py index c0e9d15..f3dd4d2 100755 --- a/test.py +++ b/test.py @@ -28,6 +28,7 @@ import sys import unittest from optparse import OptionParser import paramiko +import threading sys.path.append('tests') @@ -141,7 +142,15 @@ def main(): if len(args) > 0: filter = '|'.join(args) suite = filter_suite_by_re(suite, filter) - runner.run(suite) + result = runner.run(suite) + # Clean up stale threads from poorly cleaned-up tests. + # TODO: make that not a problem, jeez + for thread in threading.enumerate(): + if thread is not threading.currentThread(): + thread._Thread__stop() + # Exit correctly + if not result.wasSuccessful(): + sys.exit(1) if __name__ == '__main__': -- cgit v1.2.3