~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testbzr

  • Committer: Martin Pool
  • Date: 2005-04-28 09:03:12 UTC
  • Revision ID: mbp@sourcefrog.net-20050428090312-1b10892485860ef3
- fix intentional testcase failure
- log line numbers from test case
- test whoami command

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    
49
49
    if isinstance(cmd, basestring):
50
50
        cmd = cmd.split()
 
51
    log_linenumber()
51
52
    logfile.write('$ %r\n' % cmd)
52
53
    retcode = call(cmd, stdout=logfile, stderr=logfile)
53
54
    if retcode != 0:
57
58
def progress(msg):
58
59
    print '* ' + msg
59
60
    logfile.write('* '+ msg + '\n')
60
 
 
61
 
 
62
 
TESTDIR = "bzr-test.tmp"
 
61
    log_linenumber()
 
62
 
 
63
 
 
64
def log_linenumber():
 
65
    """Log the stack frame location two things up."""
 
66
    stack = traceback.extract_stack()[-3]
 
67
    logfile.write('   at %s:%d\n' % stack[:2])
 
68
 
 
69
 
 
70
TESTDIR = "testbzr.tmp"
63
71
 
64
72
# prepare an empty scratch directory
65
73
if os.path.exists(TESTDIR):
66
74
    shutil.rmtree(TESTDIR)
67
75
 
68
76
 
69
 
logfile = open('bzr-test.log', 'wt')
 
77
logfile = open('testbzr.log', 'wt', buffering=1)
70
78
 
71
79
 
72
80
try: 
77
85
    progress("testing introductory commands")
78
86
    runcmd("bzr version")
79
87
    runcmd("bzr help")
80
 
    runcmd("bzr --helpx")
 
88
    runcmd("bzr --help")
 
89
 
 
90
    progress("testing user identity")
 
91
    # this should always identify something, if only "john@localhost"
 
92
    runcmd("bzr whoami")
81
93
 
82
94
    progress("all tests passed!")
83
95
except Exception, e: