11import threading
2- import unittest
32
43import pytest
54from tornado import ioloop , web
@@ -20,7 +19,7 @@ def consume_socket(sock, chunks=65536):
2019 pass
2120
2221
23- class SocketDummyServerTestCase (unittest . TestCase ):
22+ class SocketDummyServerTestCase (object ):
2423 """
2524 A simple socket-based server is created for this class that is good for
2625 exactly one request.
@@ -67,7 +66,7 @@ def start_basic_handler(cls, **kw):
6766 )
6867
6968 @classmethod
70- def tearDownClass (cls ):
69+ def teardown_class (cls ):
7170 if hasattr (cls , "server_thread" ):
7271 cls .server_thread .join (0.1 )
7372
@@ -101,10 +100,10 @@ def _start_server(cls, socket_handler):
101100 cls .port = cls .server_thread .port
102101
103102
104- class HTTPDummyServerTestCase (unittest . TestCase ):
103+ class HTTPDummyServerTestCase (object ):
105104 """ A simple HTTP server that runs when your test class runs
106105
107- Have your unittest class inherit from this one, and then a simple server
106+ Have your test class inherit from this one, and then a simple server
108107 will start when your tests run, and automatically shut down when they
109108 complete. For examples of what test requests you can send to the server,
110109 see the TestingApp in dummyserver/handlers.py.
@@ -131,11 +130,11 @@ def _stop_server(cls):
131130 cls .server_thread .join ()
132131
133132 @classmethod
134- def setUpClass (cls ):
133+ def setup_class (cls ):
135134 cls ._start_server ()
136135
137136 @classmethod
138- def tearDownClass (cls ):
137+ def teardown_class (cls ):
139138 cls ._stop_server ()
140139
141140
@@ -150,7 +149,7 @@ class IPV6HTTPSDummyServerTestCase(HTTPSDummyServerTestCase):
150149 host = "::1"
151150
152151
153- class HTTPDummyProxyTestCase (unittest . TestCase ):
152+ class HTTPDummyProxyTestCase (object ):
154153
155154 http_host = "localhost"
156155 http_host_alt = "127.0.0.1"
@@ -163,7 +162,7 @@ class HTTPDummyProxyTestCase(unittest.TestCase):
163162 proxy_host_alt = "127.0.0.1"
164163
165164 @classmethod
166- def setUpClass (cls ):
165+ def setup_class (cls ):
167166 cls .io_loop = ioloop .IOLoop .current ()
168167
169168 app = web .Application ([(r".*" , TestingApp )])
@@ -184,7 +183,7 @@ def setUpClass(cls):
184183 cls .server_thread = run_loop_in_thread (cls .io_loop )
185184
186185 @classmethod
187- def tearDownClass (cls ):
186+ def teardown_class (cls ):
188187 cls .io_loop .add_callback (cls .http_server .stop )
189188 cls .io_loop .add_callback (cls .https_server .stop )
190189 cls .io_loop .add_callback (cls .proxy_server .stop )
0 commit comments