[PATCH] test_mkdir

John A Meinel john at arbash-meinel.com
Wed May 11 02:04:25 BST 2005


John A Meinel wrote:
>
> In the testbzr script sometimes it uses os.mkdir sometimes it uses
> runcmd(['mkdir', 'dir']) and sometimes it uses mkdir()
>
> This cleans all of that up by creating an mkdir function similiar in
> thought to the cd() function, and then updates the references.
>
> John
> =:->
>

There is a small bug in this patch, it should be:
+    logfile.write('$ mkdir %r\n' % d)
                               ^^ need the newline
>
>
> ------------------------------------------------------------------------
>
> *** modified file 'testbzr'
> --- testbzr
> +++ testbzr
> @@ -25,7 +25,6 @@
>  This replaces the previous test.sh which was not very portable."""
>
>  import sys, os, traceback
> -from os import mkdir
>  from os.path import exists
>
>  TESTDIR = "testbzr.tmp"
> @@ -45,6 +44,10 @@
>      pass
>
>
> +def mkdir(d):
> +    logfile.write('$ mkdir %r' % d)
> +    os.mkdir(d)
> +
>  def formcmd(cmd):
>      if isinstance(cmd, basestring):
>          logfile.write('$ %s\n' % cmd)
> @@ -138,7 +141,7 @@
>      print
>      print backtick([BZRPATH, 'version'])
>
> -    runcmd(['mkdir', TESTDIR])
> +    mkdir(TESTDIR)
>      cd(TESTDIR)
>
>      progress("introductory commands")
> @@ -162,7 +165,7 @@
>      runcmd("bzr diff --message foo", retcode=1)
>
>      progress("basic branch creation")
> -    runcmd(['mkdir', 'branch1'])
> +    mkdir('branch1')
>      cd('branch1')
>      runcmd('bzr init')
>
> @@ -232,7 +235,7 @@
>      runcmd(["bzr", "commit", "-m", 'add first revision'])
>
>      progress("more complex renames")
> -    os.mkdir("sub1")
> +    mkdir("sub1")
>      runcmd("bzr rename hello.txt sub1", 1)
>      runcmd("bzr rename hello.txt sub1/hello.txt", 1)
>      runcmd("bzr move hello.txt sub1", 1)
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050510/950a1120/attachment.pgp 


More information about the bazaar mailing list