/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: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2009, 2011 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
17
17
 
18
18
"""Tests for the behaviour of the Transaction concept in bzr."""
19
19
 
20
 
# import system imports here
21
 
import os
22
 
import sys
23
 
 
24
 
#import bzrlib specific imports here
25
 
import bzrlib.errors as errors
26
 
from bzrlib.tests import TestCase, TestCaseInTempDir
27
 
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
28
24
 
29
25
 
30
26
class DummyWeave(object):
39
35
            return False
40
36
        return self._message == other._message
41
37
 
 
38
    def __hash__(self):
 
39
        return hash((type(self), self._message))
 
40
 
42
41
    def transaction_finished(self):
43
42
        self.finished = True
44
43
 
46
45
class TestSymbols(TestCase):
47
46
 
48
47
    def test_public_symbols(self):
49
 
        from bzrlib.transactions import ReadOnlyTransaction
50
 
        from bzrlib.transactions import PassThroughTransaction
 
48
        from breezy.transactions import ReadOnlyTransaction  # noqa: F401
 
49
        from breezy.transactions import PassThroughTransaction  # noqa: F401
51
50
 
52
51
 
53
52
class TestReadOnlyTransaction(TestCase):
61
60
 
62
61
    def test_register_dirty_raises(self):
63
62
        self.assertRaises(errors.ReadOnlyError,
64
 
                          self.transaction.register_dirty,"anobject")
 
63
                          self.transaction.register_dirty, "anobject")
65
64
 
66
65
    def test_map(self):
67
66
        self.assertNotEqual(None, getattr(self.transaction, "map", None))
103
102
    def test_small_cache(self):
104
103
        self.transaction.set_cache_size(1)
105
104
        # add an object, should not fall right out if there are no references
106
 
        #sys.getrefcounts(foo)
 
105
        # sys.getrefcounts(foo)
107
106
        self.transaction.map.add_weave("id", DummyWeave("a weave"))
108
107
        self.transaction.register_clean(self.transaction.map.find_weave("id"))
109
108
        self.assertEqual(DummyWeave("a weave"),
263
262
    def test_small_cache(self):
264
263
        self.transaction.set_cache_size(1)
265
264
        # add an object, should not fall right out if there are no references
266
 
        #sys.getrefcounts(foo)
 
265
        # sys.getrefcounts(foo)
267
266
        self.transaction.map.add_weave("id", DummyWeave("a weave"))
268
267
        self.transaction.register_clean(self.transaction.map.find_weave("id"))
269
268
        self.assertEqual(DummyWeave("a weave"),