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

« back to all changes in this revision

Viewing changes to tracbzr/tests/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-11-06 22:15:24 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20101106221524-5qcw36mf53wlxayg
Tags: 0.4.2-1
* Run test suite during package build.
* Change section to vcs.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import logging
 
2
 
1
3
import os
2
 
import logging
3
 
 
4
 
from os import path
5
 
from shutil import rmtree
6
 
from tempfile import mkdtemp
7
4
 
8
5
from trac import config
9
6
from bzrlib import bzrdir, tests
19
16
        self.config = config.Configuration(None)
20
17
 
21
18
 
22
 
class AbstractTracTestCase(tests.TestCase):
23
 
 
24
 
    def setUp(self):
25
 
        super(AbstractTracTestCase, self).setUp()
26
 
        self.root = mkdtemp(prefix='trac+bzr-')
27
 
        self.old_cwd = os.getcwd()
28
 
        os.chdir(self.root)
29
 
 
30
 
    def trac_repo(self, location):
 
19
class AbstractTracTestCase(tests.TestCaseInTempDir):
 
20
 
 
21
    def trac_repo(self, location="repo"):
31
22
        param = { 'name': location, 'id': 'trac_bzr_selftest' }
32
 
        return backend.BzrRepository(self.root, param, DummyComponent())
33
 
 
34
 
    def tearDown(self):
35
 
        super(MultiBranchTracTestCase, self).tearDown()
36
 
        os.chdir(self.old_cwd)
37
 
        rmtree(self.root)
 
23
        return backend.BzrRepository(os.path.join(self.test_dir, "repo"), param, DummyComponent())
38
24
 
39
25
 
40
26
class MultiBranchTracTestCase(AbstractTracTestCase):
41
27
 
42
28
    def setUp(self):
43
29
        super(MultiBranchTracTestCase, self).setUp()
44
 
        dir = bzrdir.BzrDir.create(self.root)
 
30
        dir = bzrdir.BzrDir.create(os.path.join(self.test_dir, "repo"))
45
31
        self.repo = dir.create_repository()
46
 
        self.treedir = path.join(self.root, 'tree')
 
32
        self.treedir = os.path.join(self.test_dir, "repo", 'tree')
47
33
        self.branch = bzrdir.BzrDir.create_branch_convenience(self.treedir,
48
34
            force_new_tree=True)
49
35
        self.tree = self.branch.bzrdir.open_workingtree()
53
39
 
54
40
    def setUp(self):
55
41
        super(SingleBranchTracTestCase, self).setUp()
56
 
        branch = bzrdir.BzrDir.create_branch_convenience(self.root, 
57
 
                        force_new_tree=True)
 
42
        branch = bzrdir.BzrDir.create_branch_convenience(
 
43
            os.path.join(self.test_dir, "repo"), force_new_tree=True)
58
44
        self.tree = branch.bzrdir.open_workingtree()
59
45
        self.repo = branch.repository
60
 
        self.treedir = self.root
 
46
        self.treedir = os.path.join(self.test_dir, "repo")