Revision: a80430b4a75e
Branch: default
Author: Mikko Korpela <[email protected]>
Date: Mon Mar 18 03:41:31 2013
Log: Add \${LOG_LEVEL} built in variable
http://code.google.com/p/robotframework/source/detail?r=a80430b4a75e
Modified:
/atest/robot/standard_libraries/builtin/log_variables.txt
/atest/robot/variables/builtin_variables.txt
/atest/testdata/variables/builtin_variables.txt
/src/robot/libraries/BuiltIn.py
/src/robot/variables/__init__.py
=======================================
--- /atest/robot/standard_libraries/builtin/log_variables.txt Fri Oct 12
14:41:23 2012
+++ /atest/robot/standard_libraries/builtin/log_variables.txt Mon Mar 18
03:41:31 2013
@@ -20,6 +20,7 @@
Check Variable Message \${False} = * pattern=yes
Check Variable Message \${interpreter} = * pattern=yes
Check Variable Message \${LOG_FILE} = NONE
+ Check Variable Message \${LOG_LEVEL} = INFO
Check Variable Message \${None} = None
Check Variable Message \${null} = None
Check Variable Message \${OUTPUT_DIR} = * pattern=yes
@@ -43,7 +44,7 @@
Check Variable Message \@{LIST} = [ Hello | world ]
Check Variable Message \@{suite_setup_global_var} = [ Global var
set in | suite setup ]
Check Variable Message \@{suite_setup_suite_var} = [ Suite var set
in | suite setup ]
- Should Be Equal As Integers ${kw.message_count} 35 Wrong total
message count
+ Should Be Equal As Integers ${kw.message_count} 36 Wrong total
message count
Log Variables In Test
${test} = Check Test Case Log Variables
@@ -61,6 +62,7 @@
Check Variable Message \${False} = * pattern=yes
Check Variable Message \${interpreter} = * pattern=yes
Check Variable Message \${LOG_FILE} = NONE
+ Check Variable Message \${LOG_LEVEL} = TRACE
Check Variable Message \${None} = None
Check Variable Message \${null} = None
Check Variable Message \${OUTPUT_DIR} = * pattern=yes
@@ -85,7 +87,7 @@
Check Variable Message \@{LIST} = [ Hello | world ]
Check Variable Message \@{suite_setup_global_var} = [ Global var
set in | suite setup ]
Check Variable Message \@{suite_setup_suite_var} = [ Suite var set
in | suite setup ]
- Should Be Equal As Integers ${kw.message_count} 39 Wrong total
message count
+ Should Be Equal As Integers ${kw.message_count} 40 Wrong total
message count
Log Variables After Setting New Variables
${test} = Check Test Case Log Variables
@@ -104,6 +106,7 @@
Check Variable Message \${int_list} = [0, 1, 2, 3] DEBUG
Check Variable Message \${interpreter} = * DEBUG pattern=yes
Check Variable Message \${LOG_FILE} = NONE DEBUG
+ Check Variable Message \${LOG_LEVEL} = TRACE DEBUG
Check Variable Message \${None} = None DEBUG
Check Variable Message \${null} = None DEBUG
Check Variable Message \${OUTPUT_DIR} = * DEBUG pattern=yes
@@ -130,7 +133,7 @@
Check Variable Message \@{LIST} = [ Hello | world ] DEBUG
Check Variable Message \@{suite_setup_global_var} = [ Global var
set in | suite setup ] DEBUG
Check Variable Message \@{suite_setup_suite_var} = [ Suite var set
in | suite setup ] DEBUG
- Should Be Equal As Integers ${kw.message_count} 42 Wrong total
message count
+ Should Be Equal As Integers ${kw.message_count} 43 Wrong total
message count
Log Variables In User Keyword
${test} = Check Test Case Log Variables
@@ -149,6 +152,7 @@
Check Variable Message \${int_list} = [0, 1, 2, 3]
Check Variable Message \${interpreter} = * pattern=yes
Check Variable Message \${LOG_FILE} = NONE
+ Check Variable Message \${LOG_LEVEL} = TRACE
Check Variable Message \${None} = None
Check Variable Message \${null} = None
Check Variable Message \${OUTPUT_DIR} = * pattern=yes
@@ -176,7 +180,7 @@
Check Variable Message \@{LIST} = [ Hello | world ]
Check Variable Message \@{suite_setup_global_var} = [ Global var
set in | suite setup ]
Check Variable Message \@{suite_setup_suite_var} = [ Suite var set
in | suite setup ]
- Should Be Equal As Integers ${kw.message_count} 43 Wrong total
message count
+ Should Be Equal As Integers ${kw.message_count} 44 Wrong total
message count
*** Keywords ***
=======================================
--- /atest/robot/variables/builtin_variables.txt Thu Oct 11 23:13:16 2012
+++ /atest/robot/variables/builtin_variables.txt Mon Mar 18 03:41:31 2013
@@ -45,6 +45,9 @@
$CURDIR
Check Test Case ${TESTNAME}
+
+Log Level
+ Check Test Case ${TESTNAME}
Built-In Variables Cannot Be Overridden In Variable Table Or From CLI
[Documentation] Except for number variabels
=======================================
--- /atest/testdata/variables/builtin_variables.txt Thu Oct 11 23:13:16 2012
+++ /atest/testdata/variables/builtin_variables.txt Mon Mar 18 03:41:31 2013
@@ -110,6 +110,17 @@
Should Not End With ${CURDIR} \\
Comment $\{CURDIR} is resolved differently than other variables and
cannot be escaped with a backslash before it
Should Start With $\{CURDIR} $
+
+Log Level
+ ${level}= Set Log Level INFO
+ Should Be Equal ${LOG_LEVEL} INFO
+ Set Log Level TRACE
+ Run Keyword If '${LOG_LEVEL}' == 'INFO' Fail
+ Should Be Equal ${LOG_LEVEL} TRACE
+ Set Log Level WARN
+ Run Keyword If '${LOG_LEVEL}' == 'TRACE' Fail
+ Should Be Equal ${LOG_LEVEL} WARN
+ [Teardown] Set Log Level ${level}
Built-In Variables Cannot Be Overridden In Variable Table Or From CLI
[Documentation] Except for number variabels
=======================================
--- /src/robot/libraries/BuiltIn.py Thu Jan 31 13:19:03 2013
+++ /src/robot/libraries/BuiltIn.py Mon Mar 18 03:41:31 2013
@@ -1677,6 +1677,7 @@
old = self._execution_context.output.set_log_level(level)
except DataError, err:
raise RuntimeError(unicode(err))
+ self._namespace.variables.set_global('${LOG_LEVEL}', level.upper())
self.log('Log level changed from %s to %s' % (old, level.upper()))
return old
=======================================
--- /src/robot/variables/__init__.py Thu Oct 11 23:13:16 2012
+++ /src/robot/variables/__init__.py Mon Mar 18 03:41:31 2013
@@ -52,6 +52,7 @@
('${OUTPUT_FILE}', settings['Output']),
('${REPORT_FILE}', settings['Report']),
('${LOG_FILE}', settings['Log']),
+ ('${LOG_LEVEL}', settings['LogLevel']),
('${DEBUG_FILE}', settings['DebugFile']),
('${PREV_TEST_NAME}', ''),
('${PREV_TEST_STATUS}', ''),
--
---
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.