~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/whitebox.py

Hacking notes on TDD

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
2
2
import unittest
3
3
 
4
 
from bzrlib.tests import TestCaseInTempDir, TestCase
 
4
from bzrlib.selftest import TestCaseInTempDir, TestCase
5
5
from bzrlib.branch import ScratchBranch, Branch
6
 
from bzrlib.errors import PathNotChild
 
6
from bzrlib.errors import NotBranchError
7
7
 
8
8
 
9
9
class TestBranch(TestCaseInTempDir):
11
11
    def test_no_changes(self):
12
12
        from bzrlib.errors import PointlessCommit
13
13
        
14
 
        b = Branch.initialize(u'.')
 
14
        b = Branch.initialize('.')
15
15
 
16
16
        self.build_tree(['hello.txt'])
17
17
 
41
41
 
42
42
    def test_rename_dirs(self):
43
43
        """Test renaming directories and the files within them."""
44
 
        b = Branch.initialize(u'.')
 
44
        b = Branch.initialize('.')
45
45
        self.build_tree(['dir/', 'dir/sub/', 'dir/sub/file'])
46
46
        b.working_tree().add(['dir', 'dir/sub', 'dir/sub/file'])
47
47
 
94
94
            # root = nothing
95
95
            self.assertEqual(rp(dtmp), '')
96
96
 
97
 
            self.assertRaises(PathNotChild,
 
97
            self.assertRaises(NotBranchError,
98
98
                              rp,
99
99
                              '/etc')
100
100
 
101
101
            # now some near-miss operations -- note that
102
102
            # os.path.commonprefix gets these wrong!
103
 
            self.assertRaises(PathNotChild,
 
103
            self.assertRaises(NotBranchError,
104
104
                              rp,
105
105
                              dtmp.rstrip('\\/') + '2')
106
106
 
107
 
            self.assertRaises(PathNotChild,
 
107
            self.assertRaises(NotBranchError,
108
108
                              rp,
109
109
                              dtmp.rstrip('\\/') + '2/foo')
110
110
 
121
121
 
122
122
            self.assertEqual(rp(os.path.abspath('foo')), 'foo')
123
123
 
124
 
            self.assertRaises(PathNotChild,
 
124
            self.assertRaises(NotBranchError,
125
125
                              rp, '../foo')
126
126
 
127
127
        finally: