~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-09-04 02:59:56 UTC
  • mfrom: (1172)
  • mto: (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1178.
  • Revision ID: aaron.bentley@utoronto.ca-20050904025956-776ba4f07de97700
Merged mpool's latest changes (~0.0.7)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
"""
28
28
 
29
29
import sys
30
 
from bzrlib.selftest import InTempDir, BzrTestBase
31
 
 
32
 
 
33
 
class ExternalBase(InTempDir):
34
 
 
 
30
 
 
31
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
 
32
from bzrlib.branch import Branch
 
33
from bzrlib.commands import run_bzr
 
34
 
 
35
 
 
36
class ExternalBase(TestCaseInTempDir):
35
37
    def runbzr(self, args, retcode=0,backtick=False):
36
 
        try:
37
 
            import shutil
38
 
            from subprocess import call
39
 
        except ImportError, e:
40
 
            _need_subprocess()
41
 
            raise
42
 
 
43
38
        if isinstance(args, basestring):
44
39
            args = args.split()
45
40
 
50
45
            return self.runcmd(['python', self.BZRPATH,] + args,
51
46
                           retcode=retcode)
52
47
 
 
48
 
53
49
class TestCommands(ExternalBase):
54
50
 
55
51
    def test_help_commands(self):
60
56
        self.runbzr('commit -h')
61
57
 
62
58
    def test_init_branch(self):
63
 
        import os
64
59
        self.runbzr(['init'])
65
60
 
66
61
    def test_whoami(self):
200
195
    def test_merge(self):
201
196
        from bzrlib.branch import Branch
202
197
        import os
 
198
        
203
199
        os.mkdir('a')
204
200
        os.chdir('a')
 
201
 
205
202
        self.example_branch()
206
203
        os.chdir('..')
207
204
        self.runbzr('branch a b')
220
217
        a = Branch('.')
221
218
        b = Branch('../b')
222
219
        a.get_revision_xml(b.last_patch())
223
 
        print "Pending: %s" % a.pending_merges()
224
 
#        assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
225
 
#        % (a.pending_merges(), b.last_patch())
 
220
 
 
221
        self.log('pending merges: %s', a.pending_merges())
 
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
 
226
246
 
227
247
class OldTests(ExternalBase):
228
248
    """old tests moved from ./testbzr."""