16
17
# along with this program; if not, write to the Free Software
17
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
"""External black-box test for bzr.
22
This always runs bzr as an external process to try to catch bugs
23
related to argument processing, startup, etc.
25
This replaces the previous test.sh which was not very portable."""
31
from subprocess import call, Popen
32
except ImportError, e:
33
sys.stderr.write("testbzr: sorry, this test suite requires modules from python2.4\n"
39
"""run one command and check the output.
41
If a single string is based, it is split into words.
42
For commands that are not simple space-separated words, please
43
pass a list instead."""
45
if isinstance(cmd, basestring):
47
logfile.write('$ %r\n' % cmd)
48
retcode = call(cmd, stdout=logfile, stderr=logfile)
50
raise Exception("test failed: %r returned %r" % (cmd, retcode))
55
logfile.write('* '+ msg + '\n')
58
TESTDIR = "bzr-test.tmp"
60
# prepare an empty scratch directory
61
if os.path.exists(TESTDIR):
62
shutil.rmtree(TESTDIR)
65
logfile = open('bzr-test.log', 'wt')
72
progress("testing introductory commands")
77
progress("all tests passed!")
20
print 'please use "bzr selftest" instead'