~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_outside_wt.py

  • Committer: Vincent Ladeuil
  • Date: 2008-01-29 11:53:31 UTC
  • mto: (3206.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 3207.
  • Revision ID: v.ladeuil+lp@free.fr-20080129115331-n7nl3ljtkepljzwi
Fix two more leaked tmp dirs.

* bzrlib/tests/blackbox/test_outside_wt.py:
(TestOutsideWT.test_cwd_log,
TestOutsideWT.test_diff_outside_tree): Clean up tmp dir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import os
22
22
import tempfile
23
23
 
24
 
from bzrlib.tests import ChrootedTestCase
25
 
from bzrlib.osutils import getcwd
26
 
import bzrlib.urlutils as urlutils
27
 
 
28
 
 
29
 
class TestOutsideWT(ChrootedTestCase):
 
24
from bzrlib import (
 
25
    osutils,
 
26
    tests,
 
27
    urlutils,
 
28
    )
 
29
 
 
30
 
 
31
class TestOutsideWT(tests.ChrootedTestCase):
30
32
    """Test that bzr gives proper errors outside of a working tree."""
31
33
 
32
34
    def test_cwd_log(self):
33
 
        os.chdir(tempfile.mkdtemp())
 
35
        tmp_dir = tempfile.mkdtemp()
 
36
        self.addCleanup(lambda: osutils.rmtree(tmp_dir))
 
37
        os.chdir(tmp_dir)
34
38
        out, err = self.run_bzr('log', retcode=3)
35
 
        self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n' % (getcwd(),),
 
39
        self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n'
 
40
                         % (osutils.getcwd(),),
36
41
                         err)
37
42
 
38
43
    def test_url_log(self):
41
46
        self.assertEqual(u'bzr: ERROR: Not a branch:'
42
47
                         u' "%s".\n' % url, err)
43
48
 
44
 
    def test_diff_ouside_tree(self):
45
 
        os.chdir(tempfile.mkdtemp())
 
49
    def test_diff_outside_tree(self):
 
50
        tmp_dir = tempfile.mkdtemp()
 
51
        self.addCleanup(lambda: osutils.rmtree(tmp_dir))
 
52
        os.chdir(tmp_dir)
46
53
        self.run_bzr('init branch1')
47
54
        self.run_bzr(['commit', '-m', 'nothing',
48
55
                               '--unchanged', 'branch1'])
49
56
        self.run_bzr(['commit', '-m', 'nothing',
50
57
                               '--unchanged', 'branch1'])
51
 
        this_dir = getcwd()
 
58
        this_dir = osutils.getcwd()
52
59
        branch2 = "%s/branch2" % (this_dir,)
53
60
        # -r X..Y
54
61
        out, err = self.run_bzr('diff -r revno:2:branch2..revno:1', retcode=3)