Revision: d3b15e6a9ebc
Branch: default
Author: Anssi Syrjäsalo
Date: Thu May 30 07:48:32 2013
Log: All invalid commandline options are now handled as DataErrors
Update issue 1447
Implementation done. Tests updated. Need to check if there are any changes
to documentation.
http://code.google.com/p/robotframework/source/detail?r=d3b15e6a9ebc
Modified:
/atest/robot/cli/rebot/invalid_usage.txt
/atest/robot/cli/runner/cli_resource.txt
/atest/robot/cli/runner/invalid_usage.txt
/atest/robot/cli/runner/report_background.txt
/src/robot/conf/settings.py
=======================================
--- /atest/robot/cli/rebot/invalid_usage.txt Thu May 30 05:22:00 2013
+++ /atest/robot/cli/rebot/invalid_usage.txt Thu May 30 07:48:32 2013
@@ -42,11 +42,13 @@
Rebot should fail -d ${MYOUTDIR}${/}not-dir${/}dir -o out.xml -l none
-r none ${MYINPUT}
... Creating output file directory '.*' failed: .*
-Invalid Argument Values
- Run Rebot --suitestatlevel not_int --tagstatlink less_than_3x_:
${MYINPUT}
- Verify Correct Errors in Stderr Option '--suitestatlevel' expected
integer value but got 'not_int'. Default value used instead.\n
- Verify Correct Errors in Stderr Invalid format for
option '--tagstatlink'. Expected 'tag:link:title' but
got 'less_than_3x_:'.\n
- Should Be Equal ${SUITE.status} PASS
+Invalid Suite Stat Level
+ Rebot should fail --suitestatlevel not_int ${MYINPUT}
+ ... Option '--suitestatlevel' expected integer value but
got 'not_int'.
+
+Invalid Tag Stat Link
+ Rebot should fail --tagstatlink less_than_3x_: ${MYINPUT}
+ ... Invalid format for option '--tagstatlink'.
Expected 'tag:link:title' but got 'less_than_3x_:'.
*** Keywords ***
@@ -57,9 +59,3 @@
Log ${output}
Should Be Equal As Integers ${rc} 252
Should Match Regexp ${output} ^\\[ .*ERROR.* \\] ${exp
msg}${USAGETIP}$
-
-Verify Correct Errors In Stderr
- [Arguments] @{messages}
- ${error} = Set Variable If os.sep=='/' ERROR [ ERROR ]
- Check Stderr Contains ${error}
- Check Stderr Contains @{messages}
=======================================
--- /atest/robot/cli/runner/cli_resource.txt Wed May 29 03:45:04 2013
+++ /atest/robot/cli/runner/cli_resource.txt Thu May 30 07:48:32 2013
@@ -40,7 +40,3 @@
${rc} ${output} = Run And Return RC and Output ${ROBOT} ${options}
Should Be Equal As Integers ${rc} 252
Should Match Regexp ${output} ^\\[ .*ERROR.* \\] ${exp
error}${USAGETIP}$
-
-Stderr Should Contain Once [Arguments] ${msg}
- ${stderr} = Get Stderr
- Should Contain X Times ${stderr} ${msg} 1
=======================================
--- /atest/robot/cli/runner/invalid_usage.txt Thu May 30 03:59:56 2013
+++ /atest/robot/cli/runner/invalid_usage.txt Thu May 30 07:48:32 2013
@@ -22,8 +22,10 @@
Run Should Fail --invalid option option --invalid not recognized
Run Should Fail --name valid -X ${TESTFILE} option -X not recognized
-Invalid Option Values
- [Setup] Run Tests --suitestatlevel not_int --tagstatlink
less_than_3x_: ${TESTFILE}
- Stderr Should Contain Once Option '--suitestatlevel' expected integer
value but got 'not_int'. Default value used instead.\n
- Stderr Should Contain Once Invalid format for option '--tagstatlink'.
Expected 'tag:link:title' but got 'less_than_3x_:'.\n
- Should Be Equal ${SUITE.status} PASS
+Invalid Suite Stat Level
+ Run Should Fail --suitestatlevel not_int ${TESTFILE}
+ ... Option '--suitestatlevel' expected integer value but
got 'not_int'.
+
+Invalid Tag Stat Link
+ Run Should Fail --tagstatlink less_than_3x_: ${TESTFILE}
+ ... Invalid format for option '--tagstatlink'.
Expected 'tag:link:title' but got 'less_than_3x_:'.
=======================================
--- /atest/robot/cli/runner/report_background.txt Mon Jun 18 00:57:01 2012
+++ /atest/robot/cli/runner/report_background.txt Thu May 30 07:48:32 2013
@@ -1,24 +1,25 @@
*** Settings ***
Force Tags regression pybot jybot
-Resource atest_resource.txt
-Test Template Report should have correct background
+Resource cli_resource.txt
*** Test Cases ***
Default colors
+ [Template] Report should have correct background
${EMPTY}
Two custom colors
+ [Template] Report should have correct background
--reportbackground blue:red blue blue red
Three custom colors
+ [Template] Report should have correct background
--reportback green:yellow:red green yellow red
-Invalid colors are ignored with a warning
- [Template] Invalid colors should be ignored with a warning
- invalid
- too:many:colors:here
+Invalid Colors
+ Run Should Fail --reportback invalid ${SUITE_SOURCE}
+ ... Invalid report background colors 'invalid'.
*** Keywords ***
@@ -28,9 +29,3 @@
Run Tests ${opt} --report rep.html misc/pass_and_fail.txt
${report} = Get File ${OUTDIR}/rep.html
Should Contain
${report} "background":{"fail":"${fail}","nonCriticalFail":"${noncrit}","pass":"${pass}"},
-
-Invalid colors should be ignored with a warning
- [Arguments] ${colors}
- Report should have correct background --reportb ${colors}
- Check Log Message ${ERRORS.msgs[0]} Invalid report background
colors '${colors}'. ERROR
-
=======================================
--- /src/robot/conf/settings.py Thu May 30 06:02:18 2013
+++ /src/robot/conf/settings.py Thu May 30 07:48:32 2013
@@ -218,8 +218,7 @@
def _process_report_background(self, colors):
if colors.count(':') not in [1, 2]:
- LOGGER.error("Invalid report background colors '%s'." % colors)
- return self._get_default_value('ReportBackground')
+ raise DataError("Invalid report background colors '%s'." %
colors)
colors = colors.split(':')
if len(colors) == 2:
return colors[0], colors[0], colors[1]
@@ -237,9 +236,8 @@
tokens = value.split(':')
if len(tokens) >= 3:
return tokens[0], ':'.join(tokens[1:-1]), tokens[-1]
- LOGGER.error("Invalid format for option '--tagstatlink'. "
- "Expected 'tag:link:title' but got '%s'." % value)
- return None
+ raise DataError("Invalid format for option '--tagstatlink'. "
+ "Expected 'tag:link:title' but got '%s'." % value)
def _convert_to_positive_integer_or_default(self, name, value):
value = self._convert_to_integer(name, value)
@@ -249,9 +247,8 @@
try:
return int(value)
except ValueError:
- LOGGER.error("Option '--%s' expected integer value but
got '%s'. "
- "Default value used instead." % (name.lower(),
value))
- return self._get_default_value(name)
+ raise DataError("Option '--%s' expected integer value but
got '%s'."
+ % (name.lower(), value))
def _get_default_value(self, name):
return self._cli_opts[name][1]
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.