~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_add.py

merge permissions branch, also fixup tests so they are lined up with bzr.dev to help prevent conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
from bzrlib.tests import TestCaseInTempDir, TestCase
5
5
from bzrlib.branch import Branch
6
 
from bzrlib.errors import NotBranchError
 
6
from bzrlib.errors import NotBranchError, NoSuchFile
7
7
from bzrlib.inventory import InventoryFile, Inventory
8
8
from bzrlib.workingtree import WorkingTree
 
9
from bzrlib.add import smart_add
9
10
 
10
11
class TestSmartAdd(TestCaseInTempDir):
11
12
 
85
86
        self.capture('add --dry-run .')
86
87
        eq(list(t.unknowns()), ['inertiatic'])
87
88
 
 
89
    def test_add_non_existant(self):
 
90
        """Test smart-adding a file that does not exist."""
 
91
        from bzrlib.add import smart_add
 
92
        branch = Branch.initialize(u".")
 
93
        self.assertRaises(NoSuchFile, smart_add, 'non-existant-file')
 
94
 
 
95
    def test_returns(self):
 
96
        """Correctly returns added/ignored files"""
 
97
        from bzrlib.commands import run_bzr
 
98
        b = Branch.initialize(u'.')
 
99
        t = b.working_tree()
 
100
        self.build_tree(['inertiatic/', 'inertiatic/esp', 'inertiatic/CVS', 
 
101
                        'inertiatic/foo.pyc'])
 
102
        added, ignored = smart_add(u'.')
 
103
        self.AssertSubset(('inertiatic', 'inertiatic/esp'), added)
 
104
        self.AssertSubset(('CVS', '*.py[oc]'), ignored)
 
105
        self.AssertSubset(('inertiatic/CVS',), ignored['CVS'])
 
106
        self.AssertSubset(('inertiatic/foo.pyc',), ignored['*.py[oc]'])
 
107
 
 
108
 
88
109
class TestSmartAddBranch(TestCaseInTempDir):
89
110
    """Test smart adds with a specified branch."""
90
111
 
157
178
        for path in paths:
158
179
            self.assertNotEqual(tree.path2id(path), None)
159
180
 
 
181
 
160
182
class TestAddActions(TestCaseInTempDir):
161
183
 
162
184
    def test_null(self):