~bzr-pqm/bzr/bzr.dev

Viewing all changes in revision 4731.2.12.

  • Committer: Vincent Ladeuil
  • Date: 2009-10-09 23:15:22 UTC
  • mto: (5247.1.1 first-try)
  • mto: This revision was merged to the branch mainline in revision 5396.
  • Revision ID: v.ladeuil+lp@free.fr-20091009231522-09cs7tqrzi2splv7
Start adding a more precise synchronization between the various test threads.

* bzrlib/tests/https_server.py:
(TestingHTTPSServerMixin): Ensure the server is still active
before ssl-wrapping the socket.

* bzrlib/tests/http_server.py:
(TestingHTTPServerMixin): Drill down to address the thread
synchronizations bugs. Introduce a threading.Event 'serving' used
to properly handle the last connection.
(TestingHTTPServerMixin.serve): Use the 'serving' event, delegate
the execption handling to handle_request().
(TestingHTTPServerMixin.join_thread): Catch the hung threads
instead of hanging ourself.
(TestingThreadingHTTPServer.process_request_thread): Use the
received 'started' event to synchronize with the spawner.
(TestingThreadingHTTPServer.process_request): Add the thread to
the client data and wait for it to really start.
(TestingThreadingHTTPServer.shutdown_client): Join the client
thread after shutting down the socket.
(HttpServer._http_start): Add a 'started' event set when the
server is ready to accept connections.
(HttpServer.setUp): Use a threading.Event 'started' to ensure the
server is ready to accept connections.

* bzrlib/tests/__init__.py:
(CommandFailed): Not used anymore and I'm not sure it was ever
used.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: