~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
27
27
    SymlinkFeature
28
28
    )
29
29
from bzrlib.tests.blackbox import ExternalBase
30
 
from bzrlib.tests.test_win32utils import NeedsGlobExpansionFeature
31
30
 
32
31
 
33
32
def load_tests(standard_tests, module, loader):
55
54
        out = self.run_bzr('add')[0]
56
55
        # the ordering is not defined at the moment
57
56
        results = sorted(out.rstrip('\n').split('\n'))
58
 
        self.assertEquals(['If you wish to add ignored files, '
59
 
                           'please add them explicitly by name. '
60
 
                           '("bzr ignored" gives a list)',
61
 
                           'adding .bzrignore',
 
57
        self.assertEquals(['adding .bzrignore',
62
58
                           'adding dir',
63
59
                           'adding dir/sub.txt',
64
 
                           'adding top.txt',
65
 
                           'ignored 1 file(s).'],
 
60
                           'adding top.txt'],
66
61
                          results)
67
62
        out = self.run_bzr('add -v')[0]
68
63
        results = sorted(out.rstrip('\n').split('\n'))
69
 
        self.assertEquals(['If you wish to add ignored files, '\
70
 
                           'please add them explicitly by name. ("bzr ignored" gives a list)',
71
 
                           'ignored CVS matching "CVS"'],
 
64
        self.assertEquals(['ignored CVS matching "CVS"'],
72
65
                          results)
73
66
 
74
67
    def test_add_quiet_is(self):
217
210
        err = self.run_bzr('add .bzr/crescent', retcode=3)[1]
218
211
        self.assertContainsRe(err, r'ERROR:.*\.bzr.*control file')
219
212
 
220
 
    def test_add_with_wildcards(self):
221
 
        self.requireFeature(NeedsGlobExpansionFeature)
222
 
        self.make_branch_and_tree('.')
223
 
        self.build_tree(['a1', 'a2', 'b', 'c33'])
224
 
        self.run_bzr(['add', 'a?', 'c*'])
225
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'b\n')
226
 
 
227
 
    def test_add_with_wildcards_unicode(self):
228
 
        self.requireFeature(NeedsGlobExpansionFeature)
229
 
        self.make_branch_and_tree('.')
230
 
        self.build_tree([u'\u1234A', u'\u1235A', u'\u1235AA', 'cc'])
231
 
        self.run_bzr(['add', u'\u1234?', u'\u1235*'])
232
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'cc\n')
233
 
 
234
213
    def test_add_via_symlink(self):
235
214
        self.requireFeature(SymlinkFeature)
236
215
        self.make_branch_and_tree('source')