~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_test_server.py

  • Committer: Vincent Ladeuil
  • Date: 2010-06-02 20:57:53 UTC
  • mto: (5247.6.1 http-leaks)
  • mto: This revision was merged to the branch mainline in revision 5396.
  • Revision ID: v.ladeuil+lp@free.fr-20100602205753-gcsgu553qcxr41ct
Start implementing the threading variants.

* bzrlib/tests/test_test_server.py:
(TestTestingServerInAThread, TestTestingThreadingServerInAThread):
Test the threading variants.

* bzrlib/tests/test_server.py:
(TestingTCPServerMixin.__init__): Keep track of the sibling class
to better share the code.
(TestingTCPServerMixin.server_bind): Call the sibling class.
(TestingThreadingTCPServer, TestingThreadingTCPServerInAThread):
The threading versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
 
75
75
class TestTestingServerInAThread(tests.TestCase):
76
76
 
 
77
    server_in_thread_class = test_server.TestingTCPServerInAThread
 
78
 
77
79
    def get_server(self, server_class=None, connection_handler_class=None):
78
80
        if server_class is None:
79
81
            server_class = test_server.TestingTCPServer
80
82
        if connection_handler_class is None:
81
83
            connection_handler_class = TCPConnectionHandler
82
 
        server =  test_server.TestingTCPServerInAThread(
 
84
        server =  self.server_in_thread_class(
83
85
            ('localhost', 0), server_class, connection_handler_class)
84
86
        server.start_server()
85
87
        self.addCleanup(server.stop_server)
147
149
            pass
148
150
        # Now the server has raise the exception in its own thread
149
151
        self.assertRaises(ServerFailure, server.stop_server)
 
152
 
 
153
class TestTestingThreadingServerInAThread(TestTestingServerInAThread):
 
154
 
 
155
    server_in_thread_class = test_server.TestingThreadingTCPServerInAThread
 
156