~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Martin Pool
  • Date: 2005-09-01 07:28:14 UTC
  • Revision ID: mbp@sourcefrog.net-20050901072814-b2685355951a6a6a
- add test that 'bzr add' reports the files as they're added

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
"""
28
28
 
29
29
import sys
 
30
 
30
31
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
 
32
from bzrlib.branch import Branch
 
33
from bzrlib.commands import run_bzr
 
34
 
31
35
 
32
36
class ExternalBase(TestCaseInTempDir):
33
37
    def runbzr(self, args, retcode=0,backtick=False):
215
219
        a.get_revision_xml(b.last_patch())
216
220
 
217
221
        self.log('pending merges: %s', a.pending_merges())
218
 
#        assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
219
 
#        % (a.pending_merges(), b.last_patch())
 
222
        #        assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
 
223
        #        % (a.pending_merges(), b.last_patch())
 
224
 
 
225
 
 
226
    def test_add_reports(self):
 
227
        """add command prints the names of added files."""
 
228
        b = Branch('.', init=True)
 
229
        self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
 
230
 
 
231
        from cStringIO import StringIO
 
232
        out = StringIO()
 
233
 
 
234
        ret = self.apply_redirected(None, out, None,
 
235
                                    run_bzr,
 
236
                                    ['add'])
 
237
        self.assertEquals(ret, 0)
 
238
 
 
239
        # the ordering is not defined at the moment
 
240
        results = sorted(out.getvalue().rstrip('\n').split('\n'))
 
241
        self.assertEquals(['added dir',
 
242
                           'added dir/sub.txt',
 
243
                           'added top.txt',],
 
244
                          results)
 
245
 
220
246
 
221
247
class OldTests(ExternalBase):
222
248
    """old tests moved from ./testbzr."""