~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

  • Committer: Martin Pool
  • Date: 2005-06-22 07:30:45 UTC
  • Revision ID: mbp@sourcefrog.net-20050622073045-80d336b7e0b859aa
- redirect stdout/stderr while running tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
        run_bzr(['bzr', 'mkdir', 'foo'])
31
31
        self.assert_(os.path.isdir('foo'))
32
32
 
33
 
        self.assertRaises(OSError, run_bzr, ['bzr', 'mkdir', 'foo'])
34
 
 
35
 
        from bzrlib.diff import compare_trees, TreeDelta
36
 
        from bzrlib.branch import Branch
37
 
        b = Branch('.')
38
 
        
39
 
        delta = compare_trees(b.basis_tree(), b.working_tree())
40
 
 
41
 
        self.assertEquals(len(delta.added), 1)
42
 
        self.assertEquals(delta.added[0][0], 'foo')
43
 
        self.failIf(delta.modified)
44
 
 
45
 
 
46
 
 
47
 
class AddInUnversioned(InTempDir):
48
 
    def runTest(self):
49
 
        """Try to add a file in an unversioned directory.
50
 
 
51
 
        smart_add may eventually add the parent as necessary, but simple
52
 
        branch add doesn't do that.
53
 
        """
54
 
        from bzrlib.branch import Branch
55
 
        import os
56
 
        from bzrlib.errors import NotVersionedError
57
 
 
58
 
        b = Branch('.', init=True)
59
 
 
60
 
        self.build_tree(['foo/',
61
 
                         'foo/hello'])
62
 
 
63
 
        self.assertRaises(NotVersionedError,
64
 
                          b.add,
65
 
                          'foo/hello')
66
 
        
67
 
 
68
 
 
69
 
TEST_CLASSES = [
70
 
    Mkdir,
71
 
    AddInUnversioned,
72
 
    ]