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

  • Committer: Marius Kruger
  • Date: 2010-07-10 21:28:56 UTC
  • mto: (5384.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5385.
  • Revision ID: marius.kruger@enerweb.co.za-20100710212856-uq4ji3go0u5se7hx
* Update documentation
* add NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2009, 2011 Canonical Ltd
 
1
# Copyright (C) 2005 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 breezy specific imports here
21
 
import breezy.errors as errors
22
 
from breezy.tests import TestCase
23
 
import breezy.transactions as transactions
 
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
24
28
 
25
29
 
26
30
class DummyWeave(object):
35
39
            return False
36
40
        return self._message == other._message
37
41
 
38
 
    def __hash__(self):
39
 
        return hash((type(self), self._message))
40
 
 
41
42
    def transaction_finished(self):
42
43
        self.finished = True
43
44
 
45
46
class TestSymbols(TestCase):
46
47
 
47
48
    def test_public_symbols(self):
48
 
        from breezy.transactions import ReadOnlyTransaction  # noqa: F401
49
 
        from breezy.transactions import PassThroughTransaction  # noqa: F401
 
49
        from bzrlib.transactions import ReadOnlyTransaction
 
50
        from bzrlib.transactions import PassThroughTransaction
50
51
 
51
52
 
52
53
class TestReadOnlyTransaction(TestCase):
60
61
 
61
62
    def test_register_dirty_raises(self):
62
63
        self.assertRaises(errors.ReadOnlyError,
63
 
                          self.transaction.register_dirty, "anobject")
 
64
                          self.transaction.register_dirty,"anobject")
64
65
 
65
66
    def test_map(self):
66
67
        self.assertNotEqual(None, getattr(self.transaction, "map", None))
102
103
    def test_small_cache(self):
103
104
        self.transaction.set_cache_size(1)
104
105
        # add an object, should not fall right out if there are no references
105
 
        # sys.getrefcounts(foo)
 
106
        #sys.getrefcounts(foo)
106
107
        self.transaction.map.add_weave("id", DummyWeave("a weave"))
107
108
        self.transaction.register_clean(self.transaction.map.find_weave("id"))
108
109
        self.assertEqual(DummyWeave("a weave"),
262
263
    def test_small_cache(self):
263
264
        self.transaction.set_cache_size(1)
264
265
        # add an object, should not fall right out if there are no references
265
 
        # sys.getrefcounts(foo)
 
266
        #sys.getrefcounts(foo)
266
267
        self.transaction.map.add_weave("id", DummyWeave("a weave"))
267
268
        self.transaction.register_clean(self.transaction.map.find_weave("id"))
268
269
        self.assertEqual(DummyWeave("a weave"),