2 new revisions:
Revision: 154645d035e5
Author: Mikko Korpela <[email protected]>
Date: Mon Jan 16 05:42:19 2012
Log: tidy: Added input validation
http://code.google.com/p/robotframework/source/detail?r=154645d035e5
Revision: 5d35e2bdaf05
Author: Mikko Korpela <[email protected]>
Date: Tue Jan 17 00:30:48 2012
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=5d35e2bdaf05
==============================================================================
Revision: 154645d035e5
Author: Mikko Korpela <[email protected]>
Date: Mon Jan 16 05:42:19 2012
Log: tidy: Added input validation
http://code.google.com/p/robotframework/source/detail?r=154645d035e5
Modified:
/atest/robot/tidy/TidyLib.py
/src/robot/tidy.py
=======================================
--- /atest/robot/tidy/TidyLib.py Mon Jan 16 05:02:08 2012
+++ /atest/robot/tidy/TidyLib.py Mon Jan 16 05:42:19 2012
@@ -3,7 +3,10 @@
from os.path import abspath, dirname, join
from subprocess import call, STDOUT
import tempfile
+from robot import DataError
from robot.utils.asserts import assert_equals
+from robot.tidy import TidyCommandLine
+import robot.tidy
ROBOT_SRC = join(dirname(abspath(__file__)), '..', '..', '..', 'src')
@@ -36,3 +39,9 @@
for line1, line2 in zip(result.split(), expected.split()):
msg = "\n%s\n!=\n%s\n" % (result, expected)
assert_equals(repr(unicode(line1)), repr(unicode(line2)), msg)
+
+ def run_tidy(self, argument_string):
+ try:
+ TidyCommandLine(robot.tidy.__doc__).run([str(a) for a in
argument_string.split()])
+ except DataError, err:
+ raise RuntimeError(unicode(err))
=======================================
--- /src/robot/tidy.py Mon Jan 16 04:01:53 2012
+++ /src/robot/tidy.py Mon Jan 16 05:42:19 2012
@@ -100,8 +100,14 @@
def _parse_args(self, args):
options, sources = self._parser.parse_args(args, help='help')
+ if options['inplace'] and options['recursive']:
+ raise DataError('--recursive and --inplace can not be used
together')
if not options['inplace'] and len(sources) > 1:
- raise DataError('Wrong number of input files')
+ raise DataError('Expected exactly 1 input file')
+ if not sources:
+ raise DataError('Expected at least 1 input file')
+ if options['recursive'] and not os.path.isdir(sources[0]):
+ raise DataError("Invalid data source '%s'" % sources[0])
return options, sources
==============================================================================
Revision: 5d35e2bdaf05
Author: Mikko Korpela <[email protected]>
Date: Tue Jan 17 00:30:48 2012
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=5d35e2bdaf05
Modified:
/atest/robot/tidy/TidyLib.py
=======================================
--- /atest/robot/tidy/TidyLib.py Mon Jan 16 21:40:11 2012
+++ /atest/robot/tidy/TidyLib.py Tue Jan 17 00:30:48 2012
@@ -3,7 +3,10 @@
from os.path import abspath, dirname, join
from subprocess import call, STDOUT
import tempfile
+from robot import DataError
from robot.utils.asserts import assert_equals
+from robot.tidy import TidyCommandLine
+import robot.tidy
ROBOT_SRC = join(dirname(abspath(__file__)), '..', '..', '..', 'src')
@@ -40,3 +43,9 @@
for line1, line2 in zip(result.split(), expected.split()):
msg = "\n%s\n!=\n%s\n" % (result, expected)
assert_equals(repr(unicode(line1)), repr(unicode(line2)), msg)
+
+ def run_tidy(self, argument_string):
+ try:
+ TidyCommandLine(robot.tidy.__doc__).run([str(a) for a in
argument_string.split()])
+ except DataError, err:
+ raise RuntimeError(unicode(err))