~ubuntu-branches/debian/sid/trac-bzr/sid

« back to all changes in this revision

Viewing changes to debian/patches/01_test_isolation.diff

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2011-05-01 05:20:09 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20110501052009-s192c1t33hx9f7n4
Tags: 0.4.2+bzr117-1
* New upstream snapshot.
 + Drop 01_test_isolation.diff: Applied upstream.
* Add build dependency on python-bzrlib.tests, required for newer
  versions of bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
=== modified file 'tracbzr/tests/__init__.py'
2
 
--- old/tracbzr/tests/__init__.py       2010-04-12 17:43:11 +0000
3
 
+++ new/tracbzr/tests/__init__.py       2011-02-28 00:15:38 +0000
4
 
@@ -1,9 +1,6 @@
5
 
+import logging
6
 
+
7
 
 import os
8
 
-import logging
9
 
-
10
 
-from os import path
11
 
-from shutil import rmtree
12
 
-from tempfile import mkdtemp
13
 
 
14
 
 from trac import config
15
 
 from bzrlib import bzrdir, tests
16
 
@@ -19,31 +16,20 @@
17
 
         self.config = config.Configuration(None)
18
 
 
19
 
 
20
 
-class AbstractTracTestCase(tests.TestCase):
21
 
-
22
 
-    def setUp(self):
23
 
-        super(AbstractTracTestCase, self).setUp()
24
 
-        self.root = mkdtemp(prefix='trac+bzr-')
25
 
-        self.old_cwd = os.getcwd()
26
 
-        os.chdir(self.root)
27
 
-
28
 
-    def trac_repo(self, location):
29
 
+class AbstractTracTestCase(tests.TestCaseInTempDir):
30
 
+
31
 
+    def trac_repo(self, location="repo"):
32
 
         param = { 'name': location, 'id': 'trac_bzr_selftest' }
33
 
-        return backend.BzrRepository(self.root, param, DummyComponent())
34
 
-
35
 
-    def tearDown(self):
36
 
-        super(MultiBranchTracTestCase, self).tearDown()
37
 
-        os.chdir(self.old_cwd)
38
 
-        rmtree(self.root)
39
 
+        return backend.BzrRepository(os.path.join(self.test_dir, "repo"), param, DummyComponent())
40
 
 
41
 
 
42
 
 class MultiBranchTracTestCase(AbstractTracTestCase):
43
 
 
44
 
     def setUp(self):
45
 
         super(MultiBranchTracTestCase, self).setUp()
46
 
-        dir = bzrdir.BzrDir.create(self.root)
47
 
+        dir = bzrdir.BzrDir.create(os.path.join(self.test_dir, "repo"))
48
 
         self.repo = dir.create_repository()
49
 
-        self.treedir = path.join(self.root, 'tree')
50
 
+        self.treedir = os.path.join(self.test_dir, "repo", 'tree')
51
 
         self.branch = bzrdir.BzrDir.create_branch_convenience(self.treedir,
52
 
             force_new_tree=True)
53
 
         self.tree = self.branch.bzrdir.open_workingtree()
54
 
@@ -53,8 +39,8 @@
55
 
 
56
 
     def setUp(self):
57
 
         super(SingleBranchTracTestCase, self).setUp()
58
 
-        branch = bzrdir.BzrDir.create_branch_convenience(self.root, 
59
 
-                        force_new_tree=True)
60
 
+        branch = bzrdir.BzrDir.create_branch_convenience(
61
 
+            os.path.join(self.test_dir, "repo"), force_new_tree=True)
62
 
         self.tree = branch.bzrdir.open_workingtree()
63
 
         self.repo = branch.repository
64
 
-        self.treedir = self.root
65
 
+        self.treedir = os.path.join(self.test_dir, "repo")
66
 
 
67
 
=== modified file 'tracbzr/tests/test_branch.py'
68
 
--- old/tracbzr/tests/test_branch.py    2009-11-23 14:31:43 +0000
69
 
+++ new/tracbzr/tests/test_branch.py    2011-02-28 00:15:38 +0000
70
 
@@ -9,7 +9,6 @@
71
 
 
72
 
 import urllib
73
 
 
74
 
-from bzrlib import bzrdir, osutils
75
 
 from bzrlib.tests import treeshape
76
 
 from trac import versioncontrol
77
 
 
78
 
@@ -22,6 +21,8 @@
79
 
                           self.trac_repo().get_changeset, 'foo')
80
 
         self.assertRaises(versioncontrol.NoSuchChangeset, 
81
 
                           self.trac_repo().get_changeset, ',foo')
82
 
+        self.assertRaises(versioncontrol.NoSuchChangeset, 
83
 
+                          self.trac_repo().get_changeset, '1')
84
 
         revision_id = self.commit_foo_bar()
85
 
         assert revision_id is not None
86
 
         changeset = self.trac_repo().get_changeset("1")
87
 
@@ -30,9 +31,7 @@
88
 
 
89
 
     def commit_foo_bar(self):
90
 
         """Create a simple revision"""
91
 
-        treeshape.build_tree_contents([('a/',), ('a/b', 
92
 
+        treeshape.build_tree_contents([('repo/a/',), ('repo/a/b', 
93
 
                                         'contents of b')])
94
 
         self.tree.add(['a', 'a/b'])
95
 
         return self.tree.commit('tree contents', rev_id='foo%bar')
96
 
-
97
 
-
98
 
 
99
 
=== modified file 'tracbzr/tests/test_repository.py'
100
 
--- old/tracbzr/tests/test_repository.py        2009-12-17 09:37:18 +0000
101
 
+++ new/tracbzr/tests/test_repository.py        2011-02-28 00:15:38 +0000
102
 
@@ -120,11 +120,11 @@
103
 
     def test_rev(self):
104
 
         self.commit_foo_bar()
105
 
         self.assertEqual(CURRENT_REVISION, self.trac_repo().get_youngest_rev())
106
 
-        self.assertEqual('tree,1', self.trac_repo().get_oldest_rev())
107
 
+        self.assertEqual(NULL_REVISION, self.trac_repo().get_oldest_rev())
108
 
         oldest = self.tree.commit('again')
109
 
         repo = self.trac_repo()
110
 
         self.assertEqual(CURRENT_REVISION, self.trac_repo().get_youngest_rev())
111
 
-        self.assertEqual('tree,1', self.trac_repo().get_oldest_rev())
112
 
+        self.assertEqual(NULL_REVISION, self.trac_repo().get_oldest_rev())
113
 
 
114
 
     def test_previous_rev(self):
115
 
         self.commit_foo_bar_baz()
116