/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

Cleanup and refactor the server shutdown.

* bzrlib/tests/http_server.py:
(TestingHTTPServerMixin): Implement a proper server() method able
to clean after itself and interruptible by calling shutdown() from
another thread.
(HttpServer._get_httpd): The server has already got the address
from the socket, just get it from there.
(HttpServer._http_start): Delegate the service to the server
itself.
(HttpServer.tearDown): Call server.shutdown() since that's more
appropriate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
325
325
        server = http_server.HttpServer()
326
326
        server.setUp()
327
327
        try:
328
 
            self.assertTrue(server._http_running)
 
328
            self.assertTrue(server._httpd is not None)
 
329
            self.assertTrue(server._httpd.serving)
329
330
        finally:
330
331
            server.tearDown()
331
 
        self.assertFalse(server._http_running)
 
332
        self.assertFalse(server._httpd.serving)
332
333
 
333
334
    def test_create_http_server_one_zero(self):
334
335
        class RequestHandlerOneZero(http_server.TestingHTTPRequestHandler):