~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

Avoid some of the remaining closure over testcase instance cycles in tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
2106
2106
        tests.TestCase.setUp(self)
2107
2107
        self.server = self._activity_server(self._protocol_version)
2108
2108
        self.server.start_server()
2109
 
        self.activities = {}
 
2109
        activities = {} # Don't close over self and create a cycle
2110
2110
        def report_activity(t, bytes, direction):
2111
 
            count = self.activities.get(direction, 0)
 
2111
            count = activities.get(direction, 0)
2112
2112
            count += bytes
2113
 
            self.activities[direction] = count
 
2113
            activities[direction] = count
 
2114
        self.activities = activities
2114
2115
 
2115
2116
        # We override at class level because constructors may propagate the
2116
2117
        # bound method and render instance overriding ineffective (an