~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testbzr

  • Committer: Martin Pool
  • Date: 2005-04-28 09:07:38 UTC
  • Revision ID: mbp@sourcefrog.net-20050428090738-c351526f0b1f8106
testbzr:
- log directory changes
- better logging of commands

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    pass a list instead."""
48
48
    
49
49
    if isinstance(cmd, basestring):
 
50
        logfile.write('$ %s\n' % cmd)
50
51
        cmd = cmd.split()
 
52
    else:
 
53
        logfile.write('$ %r\n' % cmd)
51
54
    log_linenumber()
52
 
    logfile.write('$ %r\n' % cmd)
53
55
    actual_retcode = call(cmd, stdout=logfile, stderr=logfile)
54
56
    if retcode != actual_retcode:
55
57
        raise CommandFailed("test failed: %r returned %d, expected %d"
62
64
    log_linenumber()
63
65
 
64
66
 
 
67
def cd(dirname):
 
68
    logfile.write('$ cd %s\n' % dirname)
 
69
    os.chdir(dirname)
 
70
 
 
71
 
65
72
def log_linenumber():
66
73
    """Log the stack frame location two things up."""
67
74
    stack = traceback.extract_stack()[-3]
80
87
 
81
88
try: 
82
89
    os.mkdir(TESTDIR)
83
 
    os.chdir(TESTDIR)
84
 
 
 
90
    cd(TESTDIR)
85
91
 
86
92
    progress("testing introductory commands")
87
93
    runcmd("bzr version")