summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xtest.py8
-rw-r--r--tests/test_client.py8
2 files changed, 10 insertions, 6 deletions
diff --git a/test.py b/test.py
index c0e9d151..28ebbdb5 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,12 @@ 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()
if __name__ == '__main__':
diff --git a/tests/test_client.py b/tests/test_client.py
index 2f9b9a76..08ef1f92 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -68,11 +68,9 @@ class SSHClientTest (unittest.TestCase):
thread.start()
def tearDown(self):
- if hasattr(self, 'tc'):
- self.tc.close()
- self.ts.close()
- self.socks.close()
- self.sockl.close()
+ for attr in "tc ts socks sockl".split():
+ if hasattr(self, attr):
+ getattr(self, attr).close()
def _run(self):
self.socks, addr = self.sockl.accept()