/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/per_pack_repository.py

  • Committer: Jelmer Vernooij
  • Date: 2018-07-17 23:40:50 UTC
  • mto: (7045.3.3 python3-r)
  • mto: This revision was merged to the branch mainline in revision 7050.
  • Revision ID: jelmer@jelmer.uk-20180717234050-d8ov7a8e6dotrj07
Fix per_pack_repository tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
        name = node[1][0]
174
174
        # the pack sizes should be listed in the index
175
175
        pack_value = node[2]
176
 
        sizes = [int(digits) for digits in pack_value.split(' ')]
 
176
        sizes = [int(digits) for digits in pack_value.split(b' ')]
177
177
        for size, suffix in zip(sizes, ['.rix', '.iix', '.tix', '.six']):
178
 
            stat = trans.stat('indices/%s%s' % (name, suffix))
 
178
            stat = trans.stat('indices/%s%s' % (name.decode('ascii'), suffix))
179
179
            self.assertEqual(size, stat.st_size)
180
180
 
181
181
    def test_pulling_nothing_leads_to_no_new_names(self):
235
235
        self.vfs_transport_factory = memory.MemoryServer
236
236
        format = self.get_format()
237
237
        repo = self.make_repository('foo', format=format)
238
 
        repo.lock_write()
239
 
        try:
 
238
        with repo.lock_write():
240
239
            # All current pack repository styles autopack at 10 revisions; and
241
240
            # autopack as well as regular commit write group needs to return
242
241
            # the new pack name. Looping is a little ugly, but we don't have a
264
263
                    # In this test, len(result) is always 1, so unordered is ok
265
264
                    new_names = list(cur_names - old_names)
266
265
                    self.assertEqual(new_names, result)
267
 
        finally:
268
 
            repo.unlock()
269
266
 
270
267
    def test_fail_obsolete_deletion(self):
271
268
        # failing to delete obsolete packs is not fatal
364
361
            tree.branch.repository._pack_collection.names()[0])
365
362
        # revision access tends to be tip->ancestor, so ordering that way on
366
363
        # disk is a good idea.
 
364
        pos_1 = pos_2 = None
367
365
        for _1, key, val, refs in pack.revision_index.iter_all_entries():
368
366
            if isinstance(format.repository_format, RepositoryFormat2a):
369
367
                # group_start, group_len, internal_start, internal_len
371
369
            else:
372
370
                # eol_flag, start, len
373
371
                pos = int(val[1:].split()[0])
374
 
            if key == ('1',):
 
372
            if key == (b'1',):
375
373
                pos_1 = pos
376
374
            else:
377
375
                pos_2 = pos