[POS-commit] r5364 - kiwi/trunk/kiwi/ui/test

Johan Dahlin jdahlin at async.com.br
Tue Nov 21 14:38:32 BRST 2006


Author: jdahlin
Date: Tue Nov 21 14:38:31 2006
New Revision: 5364

Modified:
   kiwi/trunk/kiwi/ui/test/runner.py

Log:
Rewrite arg parse handling to be a bit saner

Modified: kiwi/trunk/kiwi/ui/test/runner.py
==============================================================================
--- kiwi/trunk/kiwi/ui/test/runner.py	(original)
+++ kiwi/trunk/kiwi/ui/test/runner.py	Tue Nov 21 14:38:31 2006
@@ -194,11 +194,19 @@
     if filename is None:
         fd = open(script)
         data = fd.readline()[:-1] + fd.readline()[:-1]
+
+        # Check for run: lines in the doctests
+        # run: ....
         pos = data.find('run:')
         if pos != -1:
-            filename, rest = data[pos+5:].split(' ', 1)
-            if rest:
-                args = rest.split(' ')
+            rest = data[pos+5:]
+
+            # run: foo --arg
+            if '  ' in rest:
+                filename, args = rest.split(' ', 1)
+            # run: foo
+            else:
+                filename = rest
     else:
         if args is None:
             args = []


More information about the POS-commit mailing list