~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

[patch] use unicode literals for all hardcoded paths (Alexander Belchenko)

> When you use flat string on Windows for base part of file names then all
> derived file names is always representing as flat string. On Linux/Cygwin as
> I can see in situations when path cannot be represented as flat string (or in
> ascii encoding?) it silently converted to unicode. As result we have
> different behaviour with non-ascii (non-english) file names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
    def test_append_revisions(self):
38
38
        """Test appending more than one revision"""
39
 
        br = Branch.initialize(".")
 
39
        br = Branch.initialize(u".")
40
40
        br.append_revision("rev1")
41
41
        self.assertEquals(br.revision_history(), ["rev1",])
42
42
        br.append_revision("rev2", "rev3")
64
64
        eq(tree.get_file_text('foo-id'), 'hello')
65
65
 
66
66
    def test_revision_tree(self):
67
 
        b1 = Branch.initialize('.')
 
67
        b1 = Branch.initialize(u'.')
68
68
        b1.working_tree().commit('lala!', rev_id='revision-1', allow_pointless=True)
69
69
        tree = b1.revision_tree('revision-1')
70
70
        tree = b1.revision_tree(None)
128
128
        
129
129
    def test_record_initial_ghost_merge(self):
130
130
        """A pending merge with no revision present is still a merge."""
131
 
        branch = Branch.initialize('.')
 
131
        branch = Branch.initialize(u'.')
132
132
        branch.working_tree().add_pending_merge('non:existent@rev--ision--0--2')
133
133
        branch.working_tree().commit('pretend to merge nonexistent-revision', rev_id='first')
134
134
        rev = branch.get_revision(branch.last_revision())
138
138
        self.assertEqual(rev.parent_ids[0], 'non:existent@rev--ision--0--2')
139
139
 
140
140
    def test_bad_revision(self):
141
 
        branch = Branch.initialize('.')
 
141
        branch = Branch.initialize(u'.')
142
142
        self.assertRaises(errors.InvalidRevisionId, branch.get_revision, None)
143
143
 
144
144
# TODO 20051003 RBC:
148
148
        
149
149
    def test_pending_merges(self):
150
150
        """Tracking pending-merged revisions."""
151
 
        b = Branch.initialize('.')
 
151
        b = Branch.initialize(u'.')
152
152
        wt = b.working_tree()
153
153
        self.assertEquals(wt.pending_merges(), [])
154
154
        wt.add_pending_merge('foo@azkhazan-123123-abcabc')
170
170
        self.assertEquals(wt.pending_merges(), [])
171
171
 
172
172
    def test_sign_existing_revision(self):
173
 
        branch = Branch.initialize('.')
 
173
        branch = Branch.initialize(u'.')
174
174
        branch.working_tree().commit("base", allow_pointless=True, rev_id='A')
175
175
        from bzrlib.testament import Testament
176
176
        branch.sign_revision('A', bzrlib.gpg.LoopbackGPGStrategy(None))
178
178
                         branch.revision_store.get('A', 'sig').read())
179
179
 
180
180
    def test_store_signature(self):
181
 
        branch = Branch.initialize('.')
 
181
        branch = Branch.initialize(u'.')
182
182
        branch.store_revision_signature(bzrlib.gpg.LoopbackGPGStrategy(None),
183
183
                                        'FOO', 'A')
184
184
        self.assertEqual('FOO', branch.revision_store.get('A', 'sig').read())
185
185
 
186
186
    def test__relcontrolfilename(self):
187
 
        branch = Branch.initialize('.')
 
187
        branch = Branch.initialize(u'.')
188
188
        self.assertEqual('.bzr/%25', branch._rel_controlfilename('%'))
189
189
        
190
190
    def test__relcontrolfilename_empty(self):
191
 
        branch = Branch.initialize('.')
 
191
        branch = Branch.initialize(u'.')
192
192
        self.assertEqual('.bzr', branch._rel_controlfilename(''))
193
193
 
194
194
    def test_nicks(self):
227
227
                          self.get_remote_url(''))
228
228
        self.assertRaises(NotBranchError, Branch.open_containing,
229
229
                          self.get_remote_url('g/p/q'))
230
 
        b = Branch.initialize('.')
 
230
        b = Branch.initialize(u'.')
231
231
        branch, relpath = Branch.open_containing(self.get_remote_url(''))
232
232
        self.assertEqual('', relpath)
233
233
        branch, relpath = Branch.open_containing(self.get_remote_url('g/p/q'))
319
319
 
320
320
    def setUp(self):
321
321
        super(TestBranchTransaction, self).setUp()
322
 
        self.branch = Branch.initialize('.')
 
322
        self.branch = Branch.initialize(u'.')
323
323
        
324
324
    def test_default_get_transaction(self):
325
325
        """branch.get_transaction on a new branch should give a PassThrough."""
368
368
 
369
369
    def setUp(self):
370
370
        super(TestBranchPushLocations, self).setUp()
371
 
        self.branch = Branch.initialize('.')
 
371
        self.branch = Branch.initialize(u'.')
372
372
        
373
373
    def test_get_push_location_unset(self):
374
374
        self.assertEqual(None, self.branch.get_push_location())