[MERGE] internal glob expansion for all commands on win32 and for invocations from the test suite
Robert Collins
robertc at robertcollins.net
Thu Aug 30 00:15:51 BST 2007
Robert Collins has voted resubmit.
Status is now: Resubmit
Comment:
I'd like to see more docs in HACKING. Actually describe in brief what
its about (e.g. 'command line parameters have a simple grammar with a
suffix character describing whether its singular, optional(?),
repeating(*), or repeating and a file path(#) (which get glob expanded
when the platform does not support glob expansion).')
How does one add a file called '*' on win32 with this patch? Should
--no-glob-expand turn *off* internal glob expansion (it doesn't seem to
do that).
You have a complex, buggy reimplementation of mktmp -
+def is_case_sensitive(dir):
+ """Determine the case sensitivity of a file system location.
+
+ Checks whether the file system at a given path is case sensitive or
+ not. The location has to be writable.
+ :param dir: A directory path. May be relative.
+ """
+ assert isdir(dir)
+ import random
+
+ collision = True
+ while collision:
+ nbr = random.randint(1000, 9999)
+ f1 = pathjoin(dir, '~zzz%s' % nbr)
+ f2 = pathjoin(dir, '~ZZZ%s' % nbr)
+ collision = os.path.exists(f1) or os.path.exists(f2)
+
+ file(f1, 'w').close()
+ sensitive = not os.path.exists(f2)
+ os.unlink(f1)
+ return sensitive
This would be much simpler if you:
- make a temp directory using the standard python api
- make a file called 'z' in that directory
- look for a file called 'Z'.
+
+class TestUsage(tests.TestCase):
+ """Tests for the generated usage description of a command.
+
+ (With special focus on the argument descriptions.)"""
The """ belongs on a new line (PEP8)
+ def _run(self, args, usage_msg):
+ class cmd_cmd(commands.Command):
+ takes_args = args
+ cmd = cmd_cmd()
+ self.assertEqual(usage_msg, cmd._usage());
This is misnamed - it does not 'run' the command, it checks the usage
message of an argument list. So call it that -
'assertCommandArgumentUsage(cmd, usage_message)
For details, see:
http://bundlebuggy.aaronbentley.com/request/%3C46C34626.3090706%40gmx.ch%3E
More information about the bazaar
mailing list