~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

(jelmer) Check number of connections opened during various blackbox tests.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2759
2759
    def setup_smart_server_with_call_log(self):
2760
2760
        """Sets up a smart server as the transport server with a call log."""
2761
2761
        self.transport_server = test_server.SmartTCPServer_for_testing
 
2762
        self.hpss_connections = []
2762
2763
        self.hpss_calls = []
2763
2764
        import traceback
2764
2765
        # Skip the current stack down to the caller of
2767
2768
        def capture_hpss_call(params):
2768
2769
            self.hpss_calls.append(
2769
2770
                CapturedCall(params, prefix_length))
 
2771
        def capture_connect(transport):
 
2772
            self.hpss_connections.append(transport)
2770
2773
        client._SmartClient.hooks.install_named_hook(
2771
2774
            'call', capture_hpss_call, None)
 
2775
        _mod_transport.Transport.hooks.install_named_hook(
 
2776
            'post_connect', capture_connect, None)
2772
2777
 
2773
2778
    def reset_smart_call_log(self):
2774
2779
        self.hpss_calls = []
 
2780
        self.hpss_connections = []
2775
2781
 
2776
2782
 
2777
2783
class TestCaseInTempDir(TestCaseWithMemoryTransport):