[Pkg-bazaar-commits] ./bzr/unstable r298: - test some commands known to fail

Martin Pool mbp at sourcefrog.net
Fri Apr 10 07:51:46 UTC 2009


------------------------------------------------------------
revno: 298
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Thu 2005-04-28 19:05:39 +1000
message:
  - test some commands known to fail
modified:
  testbzr
-------------- next part --------------
=== modified file 'testbzr'
--- a/testbzr	2005-04-28 09:03:12 +0000
+++ b/testbzr	2005-04-28 09:05:39 +0000
@@ -39,7 +39,7 @@
     pass
 
 
-def runcmd(cmd):
+def runcmd(cmd, retcode=0):
     """run one command and check the output.
 
     If a single string is based, it is split into words.
@@ -50,9 +50,10 @@
         cmd = cmd.split()
     log_linenumber()
     logfile.write('$ %r\n' % cmd)
-    retcode = call(cmd, stdout=logfile, stderr=logfile)
-    if retcode != 0:
-        raise CommandFailed("test failed: %r returned %r" % (cmd, retcode))
+    actual_retcode = call(cmd, stdout=logfile, stderr=logfile)
+    if retcode != actual_retcode:
+        raise CommandFailed("test failed: %r returned %d, expected %d"
+                            % (cmd, actual_retcode, retcode))
 
 
 def progress(msg):
@@ -90,6 +91,11 @@
     progress("testing user identity")
     # this should always identify something, if only "john at localhost"
     runcmd("bzr whoami")
+    runcmd("bzr whoami --email")
+
+    progress("testing invalid commands")
+    runcmd("bzr pants", retcode=1)
+    runcmd("bzr --pants off", retcode=1)
 
     progress("all tests passed!")
 except Exception, e:



More information about the Pkg-bazaar-commits mailing list