Revision: 4347
Author: janne.t.harkonen
Date: Thu Dec 2 00:49:53 2010
Log: variables: Removed deprecation warning when using same name for
list/scalar variable
http://code.google.com/p/robotframework/source/detail?r=4347
Deleted:
/trunk/atest/robot/variables/same_basename_is_deprecated.txt
/trunk/atest/testdata/variables/same_basename.py
/trunk/atest/testdata/variables/same_basename_is_deprecated.txt
Modified:
/trunk/src/robot/running/namespace.py
/trunk/src/robot/variables/variables.py
=======================================
--- /trunk/atest/robot/variables/same_basename_is_deprecated.txt Tue Aug 31
04:08:08 2010
+++ /dev/null
@@ -1,54 +0,0 @@
-*** Settings ***
-Suite Setup Run Tests ${EMPTY}
variables/same_basename_is_deprecated.txt
-Force Tags regression pybot jybot
-Resource atest_resource.txt
-
-*** Test Cases ***
-
-Variable Table
- Check Test Case ${TESTNAME}
- Verify deprecation warning with path \...@\\{table} \\$\\{TABLE}
-
-Assign Variables
- ${tc} = Check Test Case ${TESTNAME}
- Verify deprecation warning \${assign} \...@{assign}
- Check Log Message ${tc.kws[1].messages[0]} Using same base name
with scalar and list variables is deprecated. Please change
either '\${assign}' or '\...@{assign}' before Robot Framework 2.6. WARN
-
-Set Test/Suite/Global Variable
- ${tc} = Check Test Case ${TESTNAME}
- Verify deprecation warning \...@{set} \${SET}
- Check Log Message ${tc.kws[2].messages[0]} Using same base name
with scalar and list variables is deprecated. Please change
either '\...@{set}' or '\${SET}' before Robot Framework 2.6. WARN
- Length Should Be ${tc.kws[2].messages} 2
- Length Should Be ${tc.kws[4].messages} 2
- Length Should Be ${tc.kws[6].messages} 2
-
-Variable File
- Check Test Case ${TESTNAME}
- Verify deprecation warning with path \\$\\{VARFILE} \...@\\{varfile}
-
-Combinations
- Check Test Case ${TESTNAME}
- Verify deprecation warning \...@{table2} \${table2}
-
-Set Variables In User Keyword
- ${tc} = Check Test Case ${TESTNAME}
- Length Should Be ${tc.kws[1].kws[0].kws[0].kws[0].messages} 2
- Length Should Be ${tc.kws[1].kws[0].kws[0].kws[1].messages} 2
-
-Set Variable Is Suite Setup
- Length Should Be ${SUITE.setup.kws[1].messages} 2
-
-*** Keywords ***
-
-Verify deprecation warning
- [Arguments] ${1st} ${2nd}
- Check Stderr Contains [ WARN ]
- ... Using same base name with scalar and list variables is deprecated.
- ... Please change either '${1st}' or '${2nd}' before Robot Framework
2.6.
-
-Verify deprecation warning with path
- [Arguments] ${1st} ${2nd}
- Check Syslog Contains Regexp \\|\\s*WARN\\s*\\|\\s*
- ... Using same base name with scalar and list variables is
deprecated\\.
- ... Please change either '${1st}' or '${2nd}' in file '.*'
- ... before Robot Framework 2\\.6\\.
=======================================
--- /trunk/atest/testdata/variables/same_basename.py Sat Mar 27 14:22:48
2010
+++ /dev/null
@@ -1,2 +0,0 @@
-VARFILE = 'VaLuE'
-LIST__VARFILE = 'A b C'.split()
=======================================
--- /trunk/atest/testdata/variables/same_basename_is_deprecated.txt Tue Aug
31 04:08:08 2010
+++ /dev/null
@@ -1,57 +0,0 @@
-*** Settings ***
-Variables same_basename.py
-Suite Setup Setup
-
-*** Variables ***
-${TABLE}= Value
-${TABLE2}= Value2
-...@{table}= A B C
-
-*** Test Cases ***
-Variable Table
- Should Be Equal ${TABLE} Value
- Should Be True @{TABLE} == 'A B C'.split()
-
-Assign Variables
- @{assign}= Create List a b c
- ${assign}= Set Variable value
- Should Be Equal ${assign} value
- Should Be True @{assign} == 'a b c'.split()
-
-Set Test/Suite/Global Variable
- ${SET} = Set Variable initial
- Should Be Equal ${SET} initial
- Set Test Variable @{SET} test var
- Should Be True @{set} == 'test var'.split()
- Set Suite Variable @{SET} suite var
- Should Be True @{set} == 'suite var'.split()
- Set Global Variable @{SET} global var
- Should Be True @{set} == 'global var'.split()
-
-Variable File
- Should Be Equal ${VARFILE} VaLuE
- Should Be True @{VARFILE} == 'A b C'.split()
-
-Combinations
- @{table2}= Create List 42
- Should Be Equal ${TABLE2} Value2
- Should Be True @{table2} == ['42']
-
-Set Variables In User Keyword
- ${set} = Set Variable initial
- UK
-
-*** Keywords ***
-UK
- Another UK
-
-Another UK
- Warning In UK
-
-Warning In UK
- @{set} = Create List deprecated usage
- Set Test Variable @{set} another deprecated usage
-
-Setup
- Set Suite Variable ${setup} suite
- Set Suite Variable @{setup} suite var
=======================================
--- /trunk/src/robot/running/namespace.py Thu Sep 23 11:58:50 2010
+++ /trunk/src/robot/running/namespace.py Thu Dec 2 00:49:53 2010
@@ -455,22 +455,22 @@
self.current = self._uk_handlers.pop()
def set_global(self, name, value):
- GLOBAL_VARIABLES.__setitem__(name, value, depr_warning=False)
+ GLOBAL_VARIABLES.__setitem__(name, value)
for ns in robot.running.NAMESPACES:
ns.variables.set_suite(name, value)
def set_suite(self, name, value):
- self._suite.__setitem__(name, value, depr_warning=False)
+ self._suite.__setitem__(name, value)
self.set_test(name, value, False)
def set_test(self, name, value, fail_if_no_test=True):
if self._test is not None:
- self._test.__setitem__(name, value, depr_warning=False)
+ self._test.__setitem__(name, value)
elif fail_if_no_test:
raise DataError("Cannot set test variable when no test is
started")
for varz in self._uk_handlers:
- varz.__setitem__(name, value, depr_warning=False)
- self.current.__setitem__(name, value, depr_warning=True)
+ varz.__setitem__(name, value)
+ self.current.__setitem__(name, value)
def keys(self):
return self.current.keys()
=======================================
--- /trunk/src/robot/variables/variables.py Tue Oct 26 07:13:17 2010
+++ /trunk/src/robot/variables/variables.py Thu Dec 2 00:49:53 2010
@@ -46,26 +46,10 @@
utils.NormalizedDict.__init__(self, ignore=['_'])
self._identifiers = identifiers
- def __setitem__(self, name, value, path=None, depr_warning=True):
+ def __setitem__(self, name, value, path=None):
self._validate_var_name(name)
- if depr_warning:
- self._deprecation_warning_if_basename_already_used(name, path)
utils.NormalizedDict.__setitem__(self, name, value)
- def _deprecation_warning_if_basename_already_used(self, name, path):
- other = ('@' if name[0] == '$' else '$') + name[1:]
- if utils.NormalizedDict.__contains__(self, other):
- self._log_warning_when_basename_already_used(name, other, path)
-
- def _log_warning_when_basename_already_used(self, name, other, path):
- msg = ("Using same base name with scalar and list variables is "
- "deprecated. Please change either '%s' or '%s'") % (name,
other)
- if path:
- msg += " in file '%s'" % path
- msg += " before Robot Framework 2.6."
- # If path is not known we are executing keywords and can log
message
- LOGGER.warn(msg, log=not path)
-
def update(self, dict=None, **kwargs):
if dict:
self._validate_var_dict(dict)