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

  • Committer: Breezy landing bot
  • Author(s): Colin Watson
  • Date: 2020-11-16 21:47:08 UTC
  • mfrom: (7521.1.1 remove-lp-workaround)
  • Revision ID: breezy.the.bot@gmail.com-20201116214708-jos209mgxi41oy15
Remove breezy.git workaround for bazaar.launchpad.net.

Merged from https://code.launchpad.net/~cjwatson/brz/remove-lp-workaround/+merge/393710

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Tests for the behaviour of the Transaction concept in bzr."""
19
19
 
20
 
#import bzrlib specific imports here
21
 
import bzrlib.errors as errors
22
 
from bzrlib.tests import TestCase
23
 
import bzrlib.transactions as transactions
 
20
# import breezy specific imports here
 
21
import breezy.errors as errors
 
22
from breezy.tests import TestCase
 
23
import breezy.transactions as transactions
24
24
 
25
25
 
26
26
class DummyWeave(object):
35
35
            return False
36
36
        return self._message == other._message
37
37
 
 
38
    def __hash__(self):
 
39
        return hash((type(self), self._message))
 
40
 
38
41
    def transaction_finished(self):
39
42
        self.finished = True
40
43
 
42
45
class TestSymbols(TestCase):
43
46
 
44
47
    def test_public_symbols(self):
45
 
        from bzrlib.transactions import ReadOnlyTransaction
46
 
        from bzrlib.transactions import PassThroughTransaction
 
48
        from breezy.transactions import ReadOnlyTransaction  # noqa: F401
 
49
        from breezy.transactions import PassThroughTransaction  # noqa: F401
47
50
 
48
51
 
49
52
class TestReadOnlyTransaction(TestCase):
57
60
 
58
61
    def test_register_dirty_raises(self):
59
62
        self.assertRaises(errors.ReadOnlyError,
60
 
                          self.transaction.register_dirty,"anobject")
 
63
                          self.transaction.register_dirty, "anobject")
61
64
 
62
65
    def test_map(self):
63
66
        self.assertNotEqual(None, getattr(self.transaction, "map", None))
99
102
    def test_small_cache(self):
100
103
        self.transaction.set_cache_size(1)
101
104
        # add an object, should not fall right out if there are no references
102
 
        #sys.getrefcounts(foo)
 
105
        # sys.getrefcounts(foo)
103
106
        self.transaction.map.add_weave("id", DummyWeave("a weave"))
104
107
        self.transaction.register_clean(self.transaction.map.find_weave("id"))
105
108
        self.assertEqual(DummyWeave("a weave"),
259
262
    def test_small_cache(self):
260
263
        self.transaction.set_cache_size(1)
261
264
        # add an object, should not fall right out if there are no references
262
 
        #sys.getrefcounts(foo)
 
265
        # sys.getrefcounts(foo)
263
266
        self.transaction.map.add_weave("id", DummyWeave("a weave"))
264
267
        self.transaction.register_clean(self.transaction.map.find_weave("id"))
265
268
        self.assertEqual(DummyWeave("a weave"),