~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Martin Pool
  • Date: 2005-07-27 21:51:24 UTC
  • Revision ID: mbp@sourcefrog.net-20050727215124-4ebbdcb49f7bc0e3
- Factor away _parse_master_args, which seems a bit overcomplicated.

  Instead just look for --profile, --no-plugins or --builtin at start
  of the command.  

  Incidentally fix up handling of --version which was previously 
  broken.

- Add tests for 'bzr --version'

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
it's normally invoked.
27
27
"""
28
28
 
29
 
# this code was previously in testbzr
 
29
import sys
30
30
 
31
 
from unittest import TestCase
32
 
from bzrlib.selftest import TestBase, InTempDir
 
31
from bzrlib.selftest import TestBase, InTempDir, BzrTestBase
33
32
 
34
33
 
35
34
 
50
49
 
51
50
 
52
51
 
53
 
class TestVersion(ExternalBase):
 
52
class TestVersion(BzrTestBase):
 
53
    """Check output from version command and master option is reasonable"""
54
54
    def runTest(self):
55
55
        # output is intentionally passed through to stdout so that we
56
56
        # can see the version being tested
57
 
        self.runbzr(['version'])
58
 
 
 
57
        from cStringIO import StringIO
 
58
        save_out = sys.stdout
 
59
        try:
 
60
            sys.stdout = tmp_out = StringIO()
 
61
            
 
62
            self.run_bzr('version')
 
63
        finally:
 
64
            sys.stdout = save_out
 
65
 
 
66
        output = tmp_out.getvalue()
 
67
        self.log('bzr version output:')
 
68
        self.log(output)
 
69
        
 
70
        self.assert_(output.startswith('bzr (bazaar-ng) '))
 
71
        self.assertNotEqual(output.index('Canonical'), -1)
 
72
 
 
73
        # make sure --version is consistent
 
74
        try:
 
75
            sys.stdout = tmp_out = StringIO()
 
76
            
 
77
            self.run_bzr('--version')
 
78
        finally:
 
79
            sys.stdout = save_out
 
80
 
 
81
        self.log('bzr --version output:')
 
82
        self.log(tmp_out.getvalue())
 
83
 
 
84
        self.assertEquals(output, tmp_out.getvalue())
 
85
 
 
86
 
 
87
        
59
88
 
60
89
 
61
90
class HelpCommands(ExternalBase):