/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_log.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
import os
18
 
from cStringIO import StringIO
19
18
 
20
 
from breezy import (
 
19
from .. import (
21
20
    branchbuilder,
22
21
    errors,
23
22
    log,
28
27
    gpg,
29
28
    trace,
30
29
    )
 
30
from ..sixish import (
 
31
    BytesIO,
 
32
    )
31
33
 
32
34
 
33
35
class TestLogMixin(object):
692
694
        sio = self.make_utf8_encoded_stringio()
693
695
        formatter = log.LongLogFormatter(to_file=sio)
694
696
        def trivial_custom_prop_handler(revision):
695
 
            raise StandardError("a test error")
 
697
            raise Exception("a test error")
696
698
 
697
699
        log.properties_handler_registry.register(
698
700
            'trivial_custom_prop_handler',
699
701
            trivial_custom_prop_handler)
700
 
        self.assertRaises(StandardError, log.show_log, wt.branch, formatter,)
 
702
        self.assertRaises(Exception, log.show_log, wt.branch, formatter,)
701
703
 
702
704
    def test_properties_handler_bad_argument(self):
703
705
        wt = self.make_standard_commit('bad_argument',
1192
1194
 
1193
1195
    def test_show_branch_change(self):
1194
1196
        tree = self.setup_ab_tree()
1195
 
        s = StringIO()
 
1197
        s = BytesIO()
1196
1198
        log.show_branch_change(tree.branch, s, 3, '3a')
1197
1199
        self.assertContainsRe(s.getvalue(),
1198
1200
            '[*]{60}\nRemoved Revisions:\n(.|\n)*2a(.|\n)*3a(.|\n)*'
1200
1202
 
1201
1203
    def test_show_branch_change_no_change(self):
1202
1204
        tree = self.setup_ab_tree()
1203
 
        s = StringIO()
 
1205
        s = BytesIO()
1204
1206
        log.show_branch_change(tree.branch, s, 3, '3b')
1205
1207
        self.assertEqual(s.getvalue(),
1206
1208
            'Nothing seems to have changed\n')
1207
1209
 
1208
1210
    def test_show_branch_change_no_old(self):
1209
1211
        tree = self.setup_ab_tree()
1210
 
        s = StringIO()
 
1212
        s = BytesIO()
1211
1213
        log.show_branch_change(tree.branch, s, 2, '2b')
1212
1214
        self.assertContainsRe(s.getvalue(), 'Added Revisions:')
1213
1215
        self.assertNotContainsRe(s.getvalue(), 'Removed Revisions:')
1215
1217
    def test_show_branch_change_no_new(self):
1216
1218
        tree = self.setup_ab_tree()
1217
1219
        tree.branch.set_last_revision_info(2, '2b')
1218
 
        s = StringIO()
 
1220
        s = BytesIO()
1219
1221
        log.show_branch_change(tree.branch, s, 3, '3b')
1220
1222
        self.assertContainsRe(s.getvalue(), 'Removed Revisions:')
1221
1223
        self.assertNotContainsRe(s.getvalue(), 'Added Revisions:')