~ubuntu-branches/ubuntu/raring/bzr-svn/raring

« back to all changes in this revision

Viewing changes to tests/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-07-30 23:14:36 UTC
  • mfrom: (1.1.28 upstream) (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100730231436-po8j0ibgjn2d6hy0
Tags: 1.0.3-1
* New upstream release.
 + Provides BranchConfig._get_change_editor. Closes: #572109
 + Supports more trunk layout levels. Closes: #573988
* Bump standards version to 3.9.1.
* Mark as supporting bzr 2.2.
* Suggest bzr-rewrite rather than bzr-rebase. LP: #481730

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for the bzr-svn plugin."""
18
18
 
 
19
from subvertpy import NODE_UNKNOWN
19
20
import subvertpy.tests
20
21
 
21
 
 
 
22
from bzrlib import osutils
22
23
from bzrlib.bzrdir import (
23
24
    BzrDir,
24
25
    )
42
43
        :return: A bzr-friendly URL for the created repository.
43
44
        """
44
45
        return svn_to_bzr_url(
45
 
            subvertpy.tests.SubversionTestCase.make_repository(self, 
 
46
            subvertpy.tests.SubversionTestCase.make_repository(self,
46
47
                relpath, allow_revprop_changes))
47
48
 
48
49
    def setUp(self):
49
50
        subvertpy.tests.SubversionTestCase.setUp(self)
50
51
        subvertpy.tests.SubversionTestCase.tearDown(self)
51
52
        TestCaseInTempDir.setUp(self)
 
53
        if type(self.test_dir) == unicode:
 
54
            self.test_dir = self.test_dir.encode(osutils._fs_enc)
52
55
 
53
56
        try:
54
57
            from bzrlib.plugins.svn.cache import sqlitecache
88
91
 
89
92
        return BzrDir.open(repos_url)
90
93
 
 
94
    def assertChangedPathEquals(self, expected, got, msg=None):
 
95
        if expected[:3] == got[:3] and got[3] in (expected[3], NODE_UNKNOWN):
 
96
            return
 
97
        self.assertEquals(expected, got, msg)
 
98
 
 
99
    def assertChangedPathsEquals(self, expected, got, msg=None):
 
100
        self.assertIsInstance(expected, dict)
 
101
        self.assertIsInstance(got, dict)
 
102
        if len(expected) != len(got):
 
103
            self.assertEquals(expected, got, msg)
 
104
        for p, v1 in expected.iteritems():
 
105
            try:
 
106
                v2 = got[p]
 
107
            except KeyError:
 
108
                self.assertEquals(expected, got, msg)
 
109
            self.assertChangedPathEquals(v1, v2, msg)
 
110
 
 
111
    def assertBranchLogEquals(self, expected, got, msg=None):
 
112
        if len(expected) != len(got):
 
113
            self.assertEquals(expected, got, msg)
 
114
        for (root1, changes1, revnum1), (root2, changes2, revnum2) in zip(expected, got):
 
115
            self.assertEquals(revnum1, revnum2)
 
116
            self.assertEquals(root1, root2)
 
117
            self.assertChangedPathsEquals(changes1, changes2, msg)
 
118
 
91
119
 
92
120
def test_suite():
93
121
    from unittest import TestSuite
98
126
    suite = TestSuite()
99
127
 
100
128
    testmod_names = [
101
 
            'test_branch', 
102
 
            'test_branchprops', 
 
129
            'test_branch',
 
130
            'test_branchprops',
103
131
            'test_cache',
104
132
            'test_changes',
105
133
            'test_checkout',
108
136
            'test_convert',
109
137
            'test_errors',
110
138
            'test_fetch',
111
 
            'test_fileids', 
 
139
            'test_fileids',
112
140
            'test_keywords',
113
 
            'test_layout',
 
141
            'layout.test_custom',
 
142
            'layout.test_standard',
114
143
            'test_logwalker',
115
144
            'test_mapping',
116
145
            'test_parents',
117
146
            'test_push',
118
147
            'test_radir',
119
 
            'test_repository', 
 
148
            'test_repository',
120
149
            'test_revmeta',
121
150
            'test_revspec',
122
151
            'test_svk',
123
152
            'test_transport',
124
153
            'test_tree',
125
 
            'test_upgrade',
126
154
            'test_versionedfiles',
127
155
            'test_workingtree',
128
156
            'test_blackbox',