/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_cleanup.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from cStringIO import StringIO
18
17
import re
19
18
 
20
 
from bzrlib.cleanup import (
 
19
from ..cleanup import (
21
20
    _do_with_cleanups,
22
21
    _run_cleanup,
23
22
    ObjectWithCleanups,
24
23
    OperationWithCleanups,
25
24
    )
26
 
from bzrlib.tests import TestCase
27
 
from bzrlib import (
 
25
from ..sixish import (
 
26
    BytesIO,
 
27
    )
 
28
from . import TestCase
 
29
from .. import (
28
30
    debug,
29
31
    trace,
30
32
    )
81
83
        """The -Dcleanup debug flag causes cleanup errors to be reported to the
82
84
        user.
83
85
        """
84
 
        log = StringIO()
 
86
        log = BytesIO()
85
87
        trace.push_log_file(log)
86
88
        debug.debug_flags.add('cleanup')
87
89
        self.assertFalse(_run_cleanup(self.failing_cleanup))
194
196
        return [(raise_a, (), {}), (raise_b, (), {})]
195
197
 
196
198
    def test_multiple_cleanup_failures_debug_flag(self):
197
 
        log = StringIO()
 
199
        log = BytesIO()
198
200
        trace.push_log_file(log)
199
201
        debug.debug_flags.add('cleanup')
200
202
        cleanups = self.make_two_failing_cleanup_funcs()
206
208
                log.getvalue())
207
209
 
208
210
    def test_func_and_cleanup_errors_debug_flag(self):
209
 
        log = StringIO()
 
211
        log = BytesIO()
210
212
        trace.push_log_file(log)
211
213
        debug.debug_flags.add('cleanup')
212
214
        cleanups = self.make_two_failing_cleanup_funcs()
239
241
        """The -Dcleanup debug flag causes cleanup errors to be reported to the
240
242
        user.
241
243
        """
242
 
        log = StringIO()
 
244
        log = BytesIO()
243
245
        trace.push_log_file(log)
244
246
        debug.debug_flags.add('cleanup')
245
247
        self.assertRaises(ZeroDivisionError, _do_with_cleanups,