/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 brzlib/tests/test_transactions.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 12:41:27 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521124127-iv8etg0vwymyai6y
s/bzr/brz/ in apport config.

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 breezy specific imports here
21
 
import breezy.errors as errors
22
 
from breezy.tests import TestCase
23
 
import breezy.transactions as transactions
 
20
#import brzlib specific imports here
 
21
import brzlib.errors as errors
 
22
from brzlib.tests import TestCase
 
23
import brzlib.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
 
 
41
38
    def transaction_finished(self):
42
39
        self.finished = True
43
40
 
45
42
class TestSymbols(TestCase):
46
43
 
47
44
    def test_public_symbols(self):
48
 
        from breezy.transactions import ReadOnlyTransaction  # noqa: F401
49
 
        from breezy.transactions import PassThroughTransaction  # noqa: F401
 
45
        from brzlib.transactions import ReadOnlyTransaction
 
46
        from brzlib.transactions import PassThroughTransaction
50
47
 
51
48
 
52
49
class TestReadOnlyTransaction(TestCase):
60
57
 
61
58
    def test_register_dirty_raises(self):
62
59
        self.assertRaises(errors.ReadOnlyError,
63
 
                          self.transaction.register_dirty, "anobject")
 
60
                          self.transaction.register_dirty,"anobject")
64
61
 
65
62
    def test_map(self):
66
63
        self.assertNotEqual(None, getattr(self.transaction, "map", None))
102
99
    def test_small_cache(self):
103
100
        self.transaction.set_cache_size(1)
104
101
        # add an object, should not fall right out if there are no references
105
 
        # sys.getrefcounts(foo)
 
102
        #sys.getrefcounts(foo)
106
103
        self.transaction.map.add_weave("id", DummyWeave("a weave"))
107
104
        self.transaction.register_clean(self.transaction.map.find_weave("id"))
108
105
        self.assertEqual(DummyWeave("a weave"),
262
259
    def test_small_cache(self):
263
260
        self.transaction.set_cache_size(1)
264
261
        # add an object, should not fall right out if there are no references
265
 
        # sys.getrefcounts(foo)
 
262
        #sys.getrefcounts(foo)
266
263
        self.transaction.map.add_weave("id", DummyWeave("a weave"))
267
264
        self.transaction.register_clean(self.transaction.map.find_weave("id"))
268
265
        self.assertEqual(DummyWeave("a weave"),