~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testbzr

  • Committer: Martin Pool
  • Date: 2005-04-28 09:05:39 UTC
  • Revision ID: mbp@sourcefrog.net-20050428090539-22a1454942197e7c
- test some commands known to fail

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    pass
40
40
 
41
41
 
42
 
def runcmd(cmd):
 
42
def runcmd(cmd, retcode=0):
43
43
    """run one command and check the output.
44
44
 
45
45
    If a single string is based, it is split into words.
50
50
        cmd = cmd.split()
51
51
    log_linenumber()
52
52
    logfile.write('$ %r\n' % cmd)
53
 
    retcode = call(cmd, stdout=logfile, stderr=logfile)
54
 
    if retcode != 0:
55
 
        raise CommandFailed("test failed: %r returned %r" % (cmd, retcode))
 
53
    actual_retcode = call(cmd, stdout=logfile, stderr=logfile)
 
54
    if retcode != actual_retcode:
 
55
        raise CommandFailed("test failed: %r returned %d, expected %d"
 
56
                            % (cmd, actual_retcode, retcode))
56
57
 
57
58
 
58
59
def progress(msg):
90
91
    progress("testing user identity")
91
92
    # this should always identify something, if only "john@localhost"
92
93
    runcmd("bzr whoami")
 
94
    runcmd("bzr whoami --email")
 
95
 
 
96
    progress("testing invalid commands")
 
97
    runcmd("bzr pants", retcode=1)
 
98
    runcmd("bzr --pants off", retcode=1)
93
99
 
94
100
    progress("all tests passed!")
95
101
except Exception, e: