[MERGE] Unit tests for win32 glob expansion

Martin Pool mbp at canonical.com
Tue Jul 17 05:18:26 BST 2007


Martin Pool has voted +0.
Status is now: Waiting
Comment:
Hello Kuno,

Thanks for your first patch (as I think this is.)

+# Copyright (C) 2006 Canonical Ltd

It's 2007 :-)

+
+from bzrlib.tests import TestCaseInTempDir, TestSkipped
+from bzrlib.win32utils import glob_expand
+import sys
+

The coding convention is: python standard library imports first, then 
one
blank line, then bzrlib.  And in alphabetical order within each section.

+class Win32UtilsGlobExpand(TestCaseInTempDir):

Should be TestWin32UtilsGlobExpand.

+        if sys.platform != 'win32':
+             raise TestSkipped('just for the Win32 platform')

Is there a standard way to do this?  I don't think I see one yet.

+
+    def test_add_with_wildcards(self):
+        if (sys.platform != 'win32'):
+            raise TestSkipped('Unix shell glob expansion not (yet) 
accessible.')
+        self.run_bzr('init')
+        self.build_tree(['a1', 'a2', 'b', 'c33'])
+        self.run_bzr('add', 'a?', 'c*')
+        self.assertEquals(self.run_bzr('unknowns')[0], 'b\n')

In general we want to make and examine the tree using api calls, rather
than commands - so you'd do self.make_branch_and_tree('.') rather than
run_bzr('init').  However, this is consistent with the rest of the file,
so it's ok with me to do this until someone cleans up the whole file.

+        self.run_bzr('add', 'a?', 'c*')

This should be self.run_bzr(['add', 'a?', 'c*']) -- we recently 
deprecated
calling it in varargs style.

Aside from those comments this looks good to me, and it should help get
more changes into place.


For details, see: 
http://bundlebuggy.aaronbentley.com/request/%3C46980294.6040009%40gmx.ch%3E



More information about the bazaar mailing list