From babd9bd24f651bd6a956da3bd78440b4b6b4d839 Mon Sep 17 00:00:00 2001 From: Sheng Date: Fri, 1 Jun 2018 09:32:14 +0800 Subject: [PATCH] Updated tests --- tests/sshserver.py | 2 +- tests/test_app.py | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/sshserver.py b/tests/sshserver.py index 6581b32..9f9b6f0 100644 --- a/tests/sshserver.py +++ b/tests/sshserver.py @@ -124,7 +124,7 @@ def run_ssh_server(port=2200, running=True): continue # wait for auth - chan = t.accept(20) + chan = t.accept(2) if chan is None: print('*** No channel.') continue diff --git a/tests/test_app.py b/tests/test_app.py index 93cf61c..572433c 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -17,7 +17,7 @@ handler.DELAY = 0.1 class TestApp(AsyncHTTPTestCase): - _is_running = False + running = [True] sshserver_port = 2200 body = u'hostname=127.0.0.1&port={}&username=robey&password=foo'.format(sshserver_port) # noqa @@ -32,19 +32,17 @@ class TestApp(AsyncHTTPTestCase): @classmethod def setUpClass(cls): + print('='*20) t = threading.Thread( - target=run_ssh_server, args=(cls.sshserver_port, cls) + target=run_ssh_server, args=(cls.sshserver_port, cls.running) ) t.setDaemon(True) t.start() @classmethod def tearDownClass(cls): - cls._is_running = True - - @classmethod - def __bool__(cls): - return cls._is_running + cls.running.pop() + print('='*20) def test_app_with_invalid_form(self): response = self.fetch('/')