class HTTPTestCase(PantsTestCase): def request_handler(self, request): raise NotImplementedError def setUp(self): engine = Engine.instance() self.server = HTTPServer(self.request_handler, engine=engine) self.server.listen(('127.0.0.1', 4040)) PantsTestCase.setUp(self, engine) def tearDown(self): PantsTestCase.tearDown(self) self.server.close()
class WSGITestCase(PantsTestCase): def application(self, env, start_response): raise NotImplementedError def setUp(self): engine = Engine.instance() self.server = HTTPServer(WSGIConnector(self.application, debug=True), engine=engine) self.server.listen(('127.0.0.1', 4040)) PantsTestCase.setUp(self, engine) def tearDown(self): PantsTestCase.tearDown(self) self.server.close()
class HTTPTestCase(PantsTestCase): def request_handler(self, request): raise NotImplementedError def setUp(self): engine = Engine.instance() self.server = HTTPServer(self.request_handler, engine=engine) self.server.listen(("127.0.0.1", 4040)) PantsTestCase.setUp(self, engine) def tearDown(self): PantsTestCase.tearDown(self) self.server.close()
class AppTestCase(PantsTestCase): def init_app(self, app): raise NotImplementedError def setUp(self): self.app = Application() self.init_app(self.app) engine = Engine.instance() self.server = HTTPServer(self.app, engine=engine) self.server.listen(('127.0.0.1', 4040)) PantsTestCase.setUp(self, engine) def tearDown(self): PantsTestCase.tearDown(self) self.server.close()