[MERGE] cleanup blackbox tests

Martin Pool mbp at sourcefrog.net
Wed Jul 4 09:47:20 BST 2007


what I was trying to say is:


         self.build_tree(['top.txt', 'dir/', 'dir/sub.txt', 'CVS'])
         self.build_tree_contents([('.bzrignore', 'CVS\n')])
-        out = self.run_bzr(['add'], retcode=0)[0]
+        out = self.run_bzr('add', retcode=0)[0]

as a separate cleanup we should remove all these do-nothing retcode=0
parameters.

+        self.assertContainsRe(err,
+                              'ontains a branch.*but no working
tree.*checkout')

I realize you didn't write this line (i probably did), but I now know
this would be better as (?i) at the start to make it case-insensitive.


-    def ls_equals(self, value, *args):
-        out, err = self.run_bzr('ls', *args)
+    def ls_equals(self, value, args=None):
+        command = 'ls'
+        if args is not None:
+            command += ' ' + args
+        out, err = self.run_bzr(command)

This is the kind of case where it would be better to write ['ls'] +
args.  I'll change it back to that.


-    def assertInventoryEqual(self, expected, *args, **kwargs):
+    def assertInventoryEqual(self, expected, args=None, **kwargs):
         """Test that the output of 'bzr inventory' is as expected.

         Any arguments supplied will be passed to run_bzr.
         """
-        out, err = self.run_bzr('inventory', *args, **kwargs)
+        command = 'inventory'
+        if args is not None:
+            command += ' ' + args
+        out, err = self.run_bzr(command, **kwargs)
         self.assertEqual(expected, out)
         self.assertEqual('', err)
-

Similarly, this is just the kind of thing that worried Robert about
allowing string splitting.

This is likely to conflict with the add patch so I will reconcile it
with that and merge it.

Thanks, it's nice to have this tidied up.


-- 
Martin



More information about the bazaar mailing list