/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 bzrlib/tests/test_store.py

  • Committer: Robert Collins
  • Date: 2008-04-04 00:06:58 UTC
  • mto: This revision was merged to the branch mainline in revision 3350.
  • Revision ID: robertc@robertcollins.net-20080404000658-uw2nmrw8t5kcqbly
Remove manual notification of transaction finishing on versioned files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
405
405
 
406
406
class TestVersionFileStore(TestCaseWithTransport):
407
407
 
 
408
    def get_scope(self):
 
409
        return self._transaction
 
410
 
408
411
    def setUp(self):
409
412
        super(TestVersionFileStore, self).setUp()
410
413
        self.vfstore = store.versioned.VersionedFileStore(MemoryTransport())
 
414
        self.vfstore.get_scope = self.get_scope
 
415
        self._transaction = None
411
416
 
412
417
    def test_get_weave_registers_dirty_in_write(self):
413
 
        transaction = transactions.WriteTransaction()
414
 
        vf = self.vfstore.get_weave_or_empty('id', transaction)
415
 
        transaction.finish()
 
418
        self._transaction = transactions.WriteTransaction()
 
419
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
 
420
        self._transaction.finish()
 
421
        self._transaction = None
416
422
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, 'b', [], [])
417
 
        transaction = transactions.WriteTransaction()
418
 
        vf = self.vfstore.get_weave('id', transaction)
419
 
        transaction.finish()
 
423
        self._transaction = transactions.WriteTransaction()
 
424
        vf = self.vfstore.get_weave('id', self._transaction)
 
425
        self._transaction.finish()
 
426
        self._transaction = None
420
427
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, 'b', [], [])
421
428
 
422
429
    def test_get_weave_or_empty_readonly_fails(self):
423
 
        transaction = transactions.ReadOnlyTransaction()
 
430
        self._transaction = transactions.ReadOnlyTransaction()
424
431
        vf = self.assertRaises(errors.ReadOnlyError,
425
432
                               self.vfstore.get_weave_or_empty,
426
433
                               'id',
427
 
                               transaction)
 
434
                               self._transaction)
428
435
 
429
436
    def test_get_weave_readonly_cant_write(self):
430
 
        transaction = transactions.WriteTransaction()
431
 
        vf = self.vfstore.get_weave_or_empty('id', transaction)
432
 
        transaction.finish()
433
 
        transaction = transactions.ReadOnlyTransaction()
434
 
        vf = self.vfstore.get_weave_or_empty('id', transaction)
 
437
        self._transaction = transactions.WriteTransaction()
 
438
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
 
439
        self._transaction.finish()
 
440
        self._transaction = transactions.ReadOnlyTransaction()
 
441
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
435
442
        self.assertRaises(errors.ReadOnlyError, vf.add_lines, 'b', [], [])
436
443