~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_cleanup.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-02 17:59:15 UTC
  • mto: This revision was merged to the branch mainline in revision 4854.
  • Revision ID: john@arbash-meinel.com-20091202175915-me81n1ovkuml4ake
Explicitly call stream.close() in the index code.

This isn't in a finally block, but it is 'good enough'. At least .close is
being called rather than waiting for the garbage collector to run.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
39
39
        self.call_log.append('no_op_cleanup')
40
40
 
41
41
    def assertLogContains(self, regex):
42
 
        self.assertContainsRe(self.get_log(), regex, re.DOTALL)
 
42
        log = self._get_log(keep_log_file=True)
 
43
        self.assertContainsRe(log, regex, re.DOTALL)
43
44
 
44
45
    def failing_cleanup(self):
45
46
        self.call_log.append('failing_cleanup')
183
184
        self.assertRaises(ErrorA, _do_with_cleanups, cleanups,
184
185
            self.trivial_func)
185
186
        self.assertLogContains('Cleanup failed:.*ErrorB')
186
 
        self.assertFalse('ErrorA' in self.get_log())
 
187
        log = self._get_log(keep_log_file=True)
 
188
        self.assertFalse('ErrorA' in log)
187
189
 
188
190
    def make_two_failing_cleanup_funcs(self):
189
191
        def raise_a():