9 new revisions:
Revision: 85084cf8aae2
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 08:33:54 2014 UTC
Log: tidy
http://code.google.com/p/robotframework/source/detail?r=85084cf8aae2
Revision: a52ebdc454e9
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 09:00:25 2014 UTC
Log: Evaluate: Support for custom namespace....
http://code.google.com/p/robotframework/source/detail?r=a52ebdc454e9
Revision: 1e52c173fac5
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 09:01:38 2014 UTC
Log: Remote tests: took new namespace feature to use with Evaluate
http://code.google.com/p/robotframework/source/detail?r=1e52c173fac5
Revision: d613da91ea1d
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 10:12:22 2014 UTC
Log: More fixes to Remote with binary arguments...
http://code.google.com/p/robotframework/source/detail?r=d613da91ea1d
Revision: 7e1b3a34ec44
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 10:49:40 2014 UTC
Log: remote tests: timeout for waiting server to start
http://code.google.com/p/robotframework/source/detail?r=7e1b3a34ec44
Revision: 1e8f4446309c
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 15:21:20 2014 UTC
Log: rundevel.py: oops, accidentally used string 'tmp' when should
have use...
http://code.google.com/p/robotframework/source/detail?r=1e8f4446309c
Revision: b97ede5351c2
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 16:56:53 2014 UTC
Log: Remote: IronPython compatibility. Spent half-a-day debugging
these....
http://code.google.com/p/robotframework/source/detail?r=b97ede5351c2
Revision: 34f9b60a0cf0
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 17:07:13 2014 UTC
Log: Remote: cleanup
http://code.google.com/p/robotframework/source/detail?r=34f9b60a0cf0
Revision: f02bb7bd0980
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 17:07:21 2014 UTC
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=f02bb7bd0980
==============================================================================
Revision: 85084cf8aae2
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 08:33:54 2014 UTC
Log: tidy
http://code.google.com/p/robotframework/source/detail?r=85084cf8aae2
Modified:
/atest/robot/standard_libraries/builtin/evaluate.txt
/atest/testdata/standard_libraries/builtin/evaluate.txt
=======================================
--- /atest/robot/standard_libraries/builtin/evaluate.txt Wed May 25
10:28:20 2011 UTC
+++ /atest/robot/standard_libraries/builtin/evaluate.txt Thu Jan 9
08:33:54 2014 UTC
@@ -1,12 +1,11 @@
*** Settings ***
-Suite Setup Run Tests ${EMPTY}
standard_libraries/builtin/evaluate.txt
-Force Tags regression jybot pybot
-Resource atest_resource.txt
+Suite Setup Run Tests ${EMPTY}
standard_libraries/builtin/evaluate.txt
+Force Tags regression jybot pybot
+Resource atest_resource.txt
*** Test Cases ***
-
Evaluate
- Check Test Case ${TEST NAME}
+ Check Test Case ${TEST NAME}
Evaluate With Modules
- Check Test Case ${TEST NAME}
+ Check Test Case ${TEST NAME}
=======================================
--- /atest/testdata/standard_libraries/builtin/evaluate.txt Wed May 25
10:28:20 2011 UTC
+++ /atest/testdata/standard_libraries/builtin/evaluate.txt Thu Jan 9
08:33:54 2014 UTC
@@ -1,34 +1,34 @@
+*** Settings ***
+Library Collections
+
*** Variables ***
-@{HELLO} Hello world
+@{HELLO} Hello world
*** Test Cases ***
-
Evaluate
- [Documentation] FAIL STARTS: Evaluating expression 'INVALID' failed:
NameError:
- ${stat} = Evaluate True
- Should Be Equal ${stat} ${True}
- ${stat} = Evaluate False
- Should Be Equal ${stat} ${False}
- ${n} = Evaluate None
- Should Be Equal ${n} ${None}
- ${ten} = Evaluate 100 - 9*11 + int(9.9)
- Should Be Equal ${ten} ${10}
- ${dict} = Evaluate { 'a' : 1, 'b' : 2, 'c' : 3 }
- Should Be True ${dict['a']} + ${dict['b']} == ${dict['c']}
- ${len} = Evaluate len(@{HELLO})
- Should Be Equal As Integers ${len} 2
- ${hello} = Evaluate 'hello'.capitalize() + ' ' + 'world'
- Should Be Equal ${hello} Hello world
- ${stat} = Evaluate "${hello}" == ' '.join(@{HELLO})
- Should Be Equal ${stat} ${True}
- Evaluate INVALID
+ [Documentation] FAIL STARTS: Evaluating expression 'INVALID'
failed: NameError:
+ ${stat} = Evaluate True
+ Should Be Equal ${stat} ${True}
+ ${n} = Evaluate None
+ Should Be Equal ${n} ${None}
+ ${ten} = Evaluate 100 - 9*11 + int(9.9)
+ Should Be Equal ${ten} ${10}
+ ${dict} = Evaluate {'a': 1, 'b': 2, 'c': 3}
+ Should Be True ${dict['a']} + ${dict['b']} == ${dict['c']}
+ ${len} = Evaluate len(@{HELLO})
+ Should Be Equal ${len} ${2}
+ ${hello} = Evaluate 'hello'.capitalize() + ' ' + 'world'
+ Should Be Equal ${hello} Hello world
+ ${stat} = Evaluate "${hello}" == ' '.join(@{HELLO})
+ Should Be Equal ${stat} ${True}
+ Evaluate INVALID
Evaluate With Modules
- [Documentation] FAIL REGEXP: ImportError: [Nn]o module named
nonex_module
- ${ceil} = Evaluate math.ceil(1.001) math
- Should Be Equal ${ceil} ${2}
- ${random} = Evaluate random.randint(0, sys.maxint) random,sys
- ${maxint} ${sep} ${x} ${y} = Evaluate sys.maxint, os.sep,
re.escape('+'), '\\+' sys, re,,,,, glob, os,robot,,,
- Should Be True 0 <= ${random} <= ${maxint}
- Should Be Equal ${x} ${y}
- Evaluate 1 nonex_module
+ [Documentation] FAIL REGEXP: ImportError: [Nn]o module named
nonex_module
+ ${ceil} = Evaluate math.ceil(1.001) math
+ Should Be Equal ${ceil} ${2}
+ ${random} = Evaluate random.randint(0, sys.maxint)
modules=random,sys
+ ${maxint} ${sep} ${x} ${y} = Evaluate sys.maxint,
os.sep, re.escape('+'), '\\+' sys, re,,,,, glob, os,robot,,,
+ Should Be True 0 <= ${random} <= ${maxint}
+ Should Be Equal ${x} ${y}
+ Evaluate 1 nonex_module
==============================================================================
Revision: a52ebdc454e9
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 09:00:25 2014 UTC
Log: Evaluate: Support for custom namespace.
Update issue 1622
Status: Done
Implemented, tested, and documented.
http://code.google.com/p/robotframework/source/detail?r=a52ebdc454e9
Modified:
/atest/robot/standard_libraries/builtin/evaluate.txt
/atest/testdata/standard_libraries/builtin/evaluate.txt
/src/robot/libraries/BuiltIn.py
=======================================
--- /atest/robot/standard_libraries/builtin/evaluate.txt Thu Jan 9
08:33:54 2014 UTC
+++ /atest/robot/standard_libraries/builtin/evaluate.txt Thu Jan 9
09:00:25 2014 UTC
@@ -9,3 +9,6 @@
Evaluate With Modules
Check Test Case ${TEST NAME}
+
+Evaluate With Namespace
+ Check Test Case ${TEST NAME}
=======================================
--- /atest/testdata/standard_libraries/builtin/evaluate.txt Thu Jan 9
08:33:54 2014 UTC
+++ /atest/testdata/standard_libraries/builtin/evaluate.txt Thu Jan 9
09:00:25 2014 UTC
@@ -32,3 +32,10 @@
Should Be True 0 <= ${random} <= ${maxint}
Should Be Equal ${x} ${y}
Evaluate 1 nonex_module
+
+Evaluate With Namespace
+ ${ns} = Create Dictionary a=x b=${2} c=2
+ ${result} = Evaluate a*3 if b==2 and c!=2 else a
namespace=${ns}
+ Should Be Equal ${result} xxx
+ ${result} = Evaluate math.pow(b, 3) math ${ns}
+ Should Be Equal ${result} ${8}
=======================================
--- /src/robot/libraries/BuiltIn.py Tue Nov 26 12:56:51 2013 UTC
+++ /src/robot/libraries/BuiltIn.py Thu Jan 9 09:00:25 2014 UTC
@@ -2352,29 +2352,38 @@
"""
return utils.get_time(format, utils.parse_time(time_))
- def evaluate(self, expression, modules=None):
+ def evaluate(self, expression, modules=None, namespace=None):
"""Evaluates the given expression in Python and returns the
results.
`modules` argument can be used to specify a comma separated
list of Python modules to be imported and added to the
namespace of the evaluated `expression`.
+ `namespace` argument can be used to pass a custom namespace as
+ a dictionary. Possible `modules` are added to this namespace.
+
Examples (expecting `${result}` is 3.14):
| ${status} = | Evaluate | 0 < ${result} < 10 |
| ${down} = | Evaluate | int(${result}) |
| ${up} = | Evaluate | math.ceil(${result}) | math |
| ${random} = | Evaluate | random.randint(0, sys.maxint) |
random,sys |
+ | ${ns} = | Create Dictionary | x=${4} | y=${2} |
+ | ${result} = | Evaluate | x*10 + y | namespace=${ns}
|
=>
| ${status} = True
| ${down} = 3
| ${up} = 4.0
| ${random} = <random integer>
+ | ${result} = 42
Notice that instead of creating complicated expressions, it is
recommended to move the logic into a test library.
+
+ Support for `namespace` is a new feature in Robot Framework 2.8.4.
"""
- modules = modules.replace(' ','').split(',') if modules else []
- namespace = dict((m, __import__(m)) for m in modules if m != '')
+ namespace = namespace or {}
+ modules = modules.replace(' ', '').split(',') if modules else []
+ namespace.update((m, __import__(m)) for m in modules if m)
try:
return eval(expression, namespace)
except:
==============================================================================
Revision: 1e52c173fac5
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 09:01:38 2014 UTC
Log: Remote tests: took new namespace feature to use with Evaluate
http://code.google.com/p/robotframework/source/detail?r=1e52c173fac5
Modified:
/atest/testdata/standard_libraries/remote/Helper.py
/atest/testdata/standard_libraries/remote/argument_coersion.txt
=======================================
--- /atest/testdata/standard_libraries/remote/Helper.py Thu Dec 12 09:53:20
2013 UTC
+++ /atest/testdata/standard_libraries/remote/Helper.py Thu Jan 9 09:01:38
2014 UTC
@@ -1,6 +1,3 @@
-def evaluate_if_string(thing):
- return eval(thing) if isinstance(thing, basestring) else thing
-
def get_non_none(*args):
for arg in args:
if arg is not None:
=======================================
--- /atest/testdata/standard_libraries/remote/argument_coersion.txt Mon Dec
16 12:09:02 2013 UTC
+++ /atest/testdata/standard_libraries/remote/argument_coersion.txt Thu
Jan 9 09:01:38 2014 UTC
@@ -2,6 +2,7 @@
Test Template Argument Should Be Passed Correctly
Library Remote 127.0.0.1:${PORT}
Library Helper.py
+Library Collections
Variables variables.py
*** Variables ***
@@ -52,7 +53,9 @@
None ''
Arbitrary object
- ${MyObject()} '<MyObject>'
+ [Documentation] Arbitrary objects cannot be transferred over
XML-RPC and thus only their string presentation is used
+ MyObject() '<MyObject>'
+ MyObject('xxx') 'xxx'
List
\[]
@@ -78,15 +81,15 @@
{1: 'a', 2: 3, (): ()} {'1': 'a', '2': 3, '()': []}
Mapping
- ${MyMapping()} {}
- ${MyMapping(a=1)} {'a': 1}
- ${MyMapping(a='one', b=2, c=[None, True])} {'a': 'one', 'b':
2, 'c': ['', True]}
-
+ MyMapping() {}
+ MyMapping(a=1) {'a': 1}
+ MyMapping(a='one', b=2, c=[None, True]) {'a': 'one', 'b': 2, 'c':
['', True]}
*** Keywords ***
Argument Should Be Passed Correctly
[Arguments] ${argument} ${expected}=${NONE} ${binary}=${FALSE}
${expected} = Get Non None ${expected} ${argument}
- ${argument} = Evaluate If String ${argument}
+ ${ns} = Create Dictionary MyObject=${MyObject}
MyMapping=${MyMapping}
+ ${argument} = Evaluate ${argument} namespace=${ns}
Argument Should Be ${argument} ${expected} ${binary}
Kwarg Should Be argument=${argument} expected=${expected}
binary=${binary}
==============================================================================
Revision: d613da91ea1d
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 10:12:22 2014 UTC
Log: More fixes to Remote with binary arguments
Update issue 1606
More fixes with tests:
- Handle bytes above ASCII range also when they don't contain "binary"
bytes.
- Handle binary values also if custom objects contain them in their string
representation.
http://code.google.com/p/robotframework/source/detail?r=d613da91ea1d
Modified:
/atest/robot/standard_libraries/remote/argument_coersion.txt
/atest/testdata/standard_libraries/remote/argument_coersion.txt
/atest/testdata/standard_libraries/remote/arguments.py
/atest/testdata/standard_libraries/remote/variables.py
/src/robot/libraries/Remote.py
=======================================
--- /atest/robot/standard_libraries/remote/argument_coersion.txt Mon Dec 16
12:31:23 2013 UTC
+++ /atest/robot/standard_libraries/remote/argument_coersion.txt Thu Jan 9
10:12:22 2014 UTC
@@ -7,7 +7,7 @@
String
Check Test Case ${TESTNAME}
-Newline an tab
+Newline and tab
Check Test Case ${TESTNAME}
Binary
@@ -35,19 +35,55 @@
None
Check Test Case ${TESTNAME}
-Arbitrary object
+Custom object
Check Test Case ${TESTNAME}
+
+Custom object with non-ASCII representation
+ Check Test Case ${TESTNAME}
+
+Custom object with binary representation
+ Check Test Case ${TESTNAME}
List
Check Test Case ${TESTNAME}
-List like
+List with non-string values
Check Test Case ${TESTNAME}
-Dict
+List with non-ASCII values
Check Test Case ${TESTNAME}
-Dict with non-string keys
+List with non-ASCII byte values
+ Check Test Case ${TESTNAME}
+
+List with binary values
+ Check Test Case ${TESTNAME}
+
+Nested list
+ Check Test Case ${TESTNAME}
+
+List-like
+ Check Test Case ${TESTNAME}
+
+Dictionary
+ Check Test Case ${TESTNAME}
+
+Dictionary with non-string keys and values
+ Check Test Case ${TESTNAME}
+
+Dictionary with non-ASCII keys and values
+ Check Test Case ${TESTNAME}
+
+Dictionary with non-ASCII byte keys and values
+ Check Test Case ${TESTNAME}
+
+Dictionary with binary values
+ Check Test Case ${TESTNAME}
+
+Dictionary with binary keys is not supported
+ Check Test Case ${TESTNAME}
+
+Nested dictionary
Check Test Case ${TESTNAME}
Mapping
=======================================
--- /atest/testdata/standard_libraries/remote/argument_coersion.txt Thu
Jan 9 09:01:38 2014 UTC
+++ /atest/testdata/standard_libraries/remote/argument_coersion.txt Thu
Jan 9 10:12:22 2014 UTC
@@ -12,9 +12,11 @@
String
'Hello, world!'
u'hyv\\xe4 \\u2603'
+ '\\x7f'
+ u'\\x7f\\x80\\xff'
''
-Newline an tab
+Newline and tab
'\\t\\n\\r' '\\t\\n\\n'
Binary
@@ -23,7 +25,9 @@
u'\\x00\\x01' binary=yes
Binary in non-ASCII range
- '\\x00\\x01\\xff' binary=yes
+ '\\x00\\x01\\xe4' binary=yes
+ '\\x80' binary=yes
+ '\\xff' binary=yes
Binary with too big Unicode characters
[Template] Run Keyword And Expect Error
@@ -52,37 +56,72 @@
None
None ''
-Arbitrary object
+Custom object
[Documentation] Arbitrary objects cannot be transferred over
XML-RPC and thus only their string presentation is used
MyObject() '<MyObject>'
MyObject('xxx') 'xxx'
+Custom object with non-ASCII representation
+ MyObject(u'hyv\\xe4') u'hyv\\xe4'
+
+Custom object with binary representation
+ MyObject('\\x00\\x01') '\\x00\\x01'
+
List
\[]
\['a', 'b', 'c']
- \['One', -2, False]
- \[None] ['']
- \[['a', 'b'], 3, [[[4]]]]
+ \['\\x7f', u'\\x7f']
-List like
+List with non-string values
+ \[1, 2, None, (), {'a': 1}] [1, 2, '', [], {'a': 1}]
+
+List with non-ASCII values
+ \[u'\\xe4', u'\\u2603']
+
+List with non-ASCII byte values
+ \['\\x80', '\\xe4'] binary=yes
+
+List with binary values
+ \['\\x00', u'\\x01']
+
+Nested list
+ \[['a', 'b'], 3, [[[4], True]]]
+
+List-like
() []
('a', 'b', 'c') ['a', 'b', 'c']
- ('One', -2, False, (None,)) ['One', -2, False, ['']]
+ ('One', -2, False, (None,), u'\\xe4') ['One', -2, False, [''],
u'\\xe4']
set() []
xrange(5) [0, 1, 2, 3, 4]
-Dict
+Dictionary
{}
- {'one': 1, 'spam': 'eggs'}
- {None: None} {'': ''}
- {'a': 0, 'b': True, 'c': {'x': [1, 2, 3]}}
+ {'one': '1', 'spam': 'eggs'}
+ {'\\x7f': '\\x7f'}
+
+Dictionary with non-string keys and values
+ {1: 'a', 2: 3, (): (), None: None} {'1': 'a', '2': 3, '()':
[], '': ''}
+
+Dictionary with non-ASCII keys and values
+ {u'\\xe4': u'\\xe4', u'\\u2603': u'\\u2603'}
+
+Dictionary with non-ASCII byte keys and values
+ {'\\x80': '\\x80'} {'\\\\x80': '\\x80'} binary=yes
+ {'\\xe4': '\\xe4'} {'\\\\xe4': '\\xe4'} binary=yes
+
+Dictionary with binary values
+ {0: '\\x00', 1: u'\\x01'} {'0': '\\x00', '1': '\\x01'}
+
+Dictionary with binary keys is not supported
+ [Documentation] FAIL TypeError: unhashable instance
+ {'\\x00': 'value'}
-Dict with non-string keys
- {1: 'a', 2: 3, (): ()} {'1': 'a', '2': 3, '()': []}
+Nested dictionary
+ {'a': 0, 'b': True, 'c': {'x': [1, 2, 3]}, '\\x7f': '\\x7f'}
Mapping
MyMapping() {}
- MyMapping(a=1) {'a': 1}
+ MyMapping(a=1, b='\\x01') {'a': 1, 'b': '\\x01'}
MyMapping(a='one', b=2, c=[None, True]) {'a': 'one', 'b': 2, 'c':
['', True]}
*** Keywords ***
=======================================
--- /atest/testdata/standard_libraries/remote/arguments.py Sat Dec 14
23:04:36 2013 UTC
+++ /atest/testdata/standard_libraries/remote/arguments.py Thu Jan 9
10:12:22 2014 UTC
@@ -8,11 +8,29 @@
def argument_should_be(self, argument, expected, binary=False):
if binary:
- assert isinstance(argument, Binary), 'Non-binary argument'
- argument = str(argument)
+ argument = self._handle_binary(argument)
expected = eval(expected)
assert argument == expected, '%r != %r' % (argument, expected)
+ def _handle_binary(self, arg, required=True):
+ if isinstance(arg, list):
+ return self._handle_binary_in_list(arg)
+ if isinstance(arg, dict):
+ return self._handle_binary_in_dict(arg)
+ assert isinstance(arg, Binary) or not required, 'Non-binary
argument'
+ return str(arg) if isinstance(arg, Binary) else arg
+
+ def _handle_binary_in_list(self, arg):
+ assert any(isinstance(a, Binary) for a in arg)
+ return [self._handle_binary(a, required=False) for a in arg]
+
+ def _handle_binary_in_dict(self, arg):
+ assert any(isinstance(key, Binary) or isinstance(value, Binary)
+ for key, value in arg.items())
+ return dict((self._handle_binary(key, required=False),
+ self._handle_binary(value, required=False))
+ for key, value in arg.items())
+
def kwarg_should_be(self, **kwargs):
self.argument_should_be(**kwargs)
=======================================
--- /atest/testdata/standard_libraries/remote/variables.py Mon Dec 16
12:09:02 2013 UTC
+++ /atest/testdata/standard_libraries/remote/variables.py Thu Jan 9
10:12:22 2014 UTC
@@ -1,7 +1,10 @@
class MyObject(object):
+ def __init__(self, name='<MyObject>'):
+ self.name = name
+
def __str__(self):
- return '<MyObject>'
+ return self.name
try:
from collections import Mapping
=======================================
--- /src/robot/libraries/Remote.py Mon Dec 16 12:09:02 2013 UTC
+++ /src/robot/libraries/Remote.py Thu Jan 9 10:12:22 2014 UTC
@@ -70,15 +70,16 @@
class ArgumentCoercer(object):
binary = re.compile('[\x00-\x08\x0B\x0C\x0E-\x1F]')
+ non_ascii = re.compile('[\x80-\xff]')
- def coerce(self, arg):
+ def coerce(self, argument):
for handles, handle in [(self._is_string, self._handle_string),
(self._is_number, self._pass_through),
(is_list_like, self._coerce_list),
(is_dict_like, self._coerce_dict),
(lambda arg: True, self._to_string)]:
- if handles(arg):
- return handle(arg)
+ if handles(argument):
+ return handle(argument)
def _is_string(self, arg):
return isinstance(arg, basestring)
@@ -87,8 +88,13 @@
return isinstance(arg, (int, long, float))
def _handle_string(self, arg):
- if not self.binary.search(arg):
- return arg
+ if self.binary.search(arg):
+ return self._handle_binary(arg)
+ if isinstance(arg, str) and self.non_ascii.search(arg):
+ return self._handle_binary(arg)
+ return arg
+
+ def _handle_binary(self, arg):
try:
arg = str(arg)
except UnicodeError:
@@ -102,13 +108,12 @@
return [self.coerce(item) for item in arg]
def _coerce_dict(self, arg):
- return dict((self._to_string(key), self.coerce(value))
- for key, value in arg.items())
+ return dict((self._to_string(key), self.coerce(arg[key]))
+ for key in arg)
def _to_string(self, item):
- if item is None:
- return ''
- return unic(item)
+ item = unic(item) if item is not None else ''
+ return self._handle_string(item)
class RemoteResult(object):
==============================================================================
Revision: 7e1b3a34ec44
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 10:49:40 2014 UTC
Log: remote tests: timeout for waiting server to start
http://code.google.com/p/robotframework/source/detail?r=7e1b3a34ec44
Modified:
/atest/robot/standard_libraries/remote/remote_resource.txt
=======================================
--- /atest/robot/standard_libraries/remote/remote_resource.txt Sun Dec 15
00:27:17 2013 UTC
+++ /atest/robot/standard_libraries/remote/remote_resource.txt Thu Jan 9
10:49:40 2014 UTC
@@ -18,7 +18,7 @@
${path} = Normalize Path
${DATADIR}/standard_libraries/remote/${server}
Start Process python ${path} ${port} ${PORT FILE}
... alias=${server} stdout=${STDOUT FILE} stderr=STDOUT
- Wait Until Created ${PORT FILE}
+ Wait Until Created ${PORT FILE} 30s
${port} = Get File ${PORT FILE}
[Return] ${port}
==============================================================================
Revision: 1e8f4446309c
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 15:21:20 2014 UTC
Log: rundevel.py: oops, accidentally used string 'tmp' when should
have used variable tmp. only matters when running this scripts elsewhere
where than project root.
http://code.google.com/p/robotframework/source/detail?r=1e8f4446309c
Modified:
/rundevel.py
=======================================
--- /rundevel.py Thu Dec 12 23:37:13 2013 UTC
+++ /rundevel.py Thu Jan 9 15:21:20 2014 UTC
@@ -37,4 +37,4 @@
args += sys.argv[2:] if sys.argv[1] == 'run' else sys.argv[1:]
putenv('ROBOT_SYSLOG_FILE', join(tmp, 'syslog.txt'))
-runner(['--outputdir', 'tmp'] + args)
+runner(['--outputdir', tmp] + args)
==============================================================================
Revision: b97ede5351c2
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 16:56:53 2014 UTC
Log: Remote: IronPython compatibility. Spent half-a-day debugging
these....
http://code.google.com/p/robotframework/source/detail?r=b97ede5351c2
Modified:
/atest/robot/standard_libraries/remote/argument_coersion.txt
/atest/testdata/standard_libraries/remote/argument_coersion.txt
/src/robot/libraries/Remote.py
=======================================
--- /atest/robot/standard_libraries/remote/argument_coersion.txt Thu Jan 9
10:12:22 2014 UTC
+++ /atest/robot/standard_libraries/remote/argument_coersion.txt Thu Jan 9
16:56:53 2014 UTC
@@ -54,6 +54,7 @@
Check Test Case ${TESTNAME}
List with non-ASCII byte values
+ [Tags] x-fails-on-ipy
Check Test Case ${TESTNAME}
List with binary values
@@ -71,17 +72,22 @@
Dictionary with non-string keys and values
Check Test Case ${TESTNAME}
-Dictionary with non-ASCII keys and values
+Dictionary with non-ASCII keys
+ [Tags] x-fails-on-ipy
Check Test Case ${TESTNAME}
-Dictionary with non-ASCII byte keys and values
+Dictionary with non-ASCII values
Check Test Case ${TESTNAME}
-Dictionary with binary values
+Dictionary with non-ASCII byte keys and values
+ [Tags] x-fails-on-ipy
Check Test Case ${TESTNAME}
Dictionary with binary keys is not supported
Check Test Case ${TESTNAME}
+
+Dictionary with binary values
+ Check Test Case ${TESTNAME}
Nested dictionary
Check Test Case ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/remote/argument_coersion.txt Thu
Jan 9 10:12:22 2014 UTC
+++ /atest/testdata/standard_libraries/remote/argument_coersion.txt Thu
Jan 9 16:56:53 2014 UTC
@@ -102,19 +102,24 @@
Dictionary with non-string keys and values
{1: 'a', 2: 3, (): (), None: None} {'1': 'a', '2': 3, '()':
[], '': ''}
-Dictionary with non-ASCII keys and values
- {u'\\xe4': u'\\xe4', u'\\u2603': u'\\u2603'}
+Dictionary with non-ASCII keys
+ {u'\\xe4': 1}
+ {u'\\u2603': 2}
+
+Dictionary with non-ASCII values
+ {'1': u'\\xe4'}
+ {'2': u'\\u2603'}
Dictionary with non-ASCII byte keys and values
{'\\x80': '\\x80'} {'\\\\x80': '\\x80'} binary=yes
{'\\xe4': '\\xe4'} {'\\\\xe4': '\\xe4'} binary=yes
-
-Dictionary with binary values
- {0: '\\x00', 1: u'\\x01'} {'0': '\\x00', '1': '\\x01'}
Dictionary with binary keys is not supported
[Documentation] FAIL TypeError: unhashable instance
{'\\x00': 'value'}
+
+Dictionary with binary values
+ {0: '\\x00', 1: u'\\x01'} {'0': '\\x00', '1': '\\x01'}
Nested dictionary
{'a': 0, 'b': True, 'c': {'x': [1, 2, 3]}, '\\x7f': '\\x7f'}
=======================================
--- /src/robot/libraries/Remote.py Thu Jan 9 10:12:22 2014 UTC
+++ /src/robot/libraries/Remote.py Thu Jan 9 16:56:53 2014 UTC
@@ -27,6 +27,9 @@
from robot.utils import is_list_like, is_dict_like, unic
+IRONPYTHON = sys.platform == 'cli'
+
+
class Remote(object):
ROBOT_LIBRARY_SCOPE = 'TEST SUITE'
@@ -90,7 +93,7 @@
def _handle_string(self, arg):
if self.binary.search(arg):
return self._handle_binary(arg)
- if isinstance(arg, str) and self.non_ascii.search(arg):
+ if isinstance(arg, str) and not IRONPYTHON and
self.non_ascii.search(arg):
return self._handle_binary(arg)
return arg
@@ -108,8 +111,20 @@
return [self.coerce(item) for item in arg]
def _coerce_dict(self, arg):
- return dict((self._to_string(key), self.coerce(arg[key]))
- for key in arg)
+ return dict((self._to_key(key), self.coerce(arg[key])) for key in
arg)
+
+ def _to_key(self, item):
+ item = self._to_string(item)
+ self._validate_key(item)
+ return item
+
+ def _validate_key(self, item):
+ if IRONPYTHON:
+ try:
+ return str(item)
+ except UnicodeError:
+ raise ValueError('Dictionary keys cannot contain
non-ASCII '
+ 'characters with IronPython.')
def _to_string(self, item):
item = unic(item) if item is not None else ''
==============================================================================
Revision: 34f9b60a0cf0
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 17:07:13 2014 UTC
Log: Remote: cleanup
http://code.google.com/p/robotframework/source/detail?r=34f9b60a0cf0
Modified:
/src/robot/libraries/Remote.py
=======================================
--- /src/robot/libraries/Remote.py Thu Jan 9 16:56:53 2014 UTC
+++ /src/robot/libraries/Remote.py Thu Jan 9 17:07:13 2014 UTC
@@ -91,17 +91,20 @@
return isinstance(arg, (int, long, float))
def _handle_string(self, arg):
- if self.binary.search(arg):
+ if self._contains_binary(arg):
return self._handle_binary(arg)
- if isinstance(arg, str) and not IRONPYTHON and
self.non_ascii.search(arg):
- return self._handle_binary(arg)
return arg
+ def _contains_binary(self, arg):
+ return (self.binary.search(arg) or
+ isinstance(arg, str) and not IRONPYTHON and
+ self.non_ascii.search(arg))
+
def _handle_binary(self, arg):
try:
arg = str(arg)
except UnicodeError:
- raise ValueError("Cannot represent %r as binary." % arg)
+ raise ValueError('Cannot represent %r as binary.' % arg)
return xmlrpclib.Binary(arg)
def _pass_through(self, arg):
@@ -115,21 +118,21 @@
def _to_key(self, item):
item = self._to_string(item)
- self._validate_key(item)
+ if IRONPYTHON:
+ self._validate_key_on_ironpython(item)
return item
- def _validate_key(self, item):
- if IRONPYTHON:
- try:
- return str(item)
- except UnicodeError:
- raise ValueError('Dictionary keys cannot contain
non-ASCII '
- 'characters with IronPython.')
-
def _to_string(self, item):
item = unic(item) if item is not None else ''
return self._handle_string(item)
+ def _validate_key_on_ironpython(self, item):
+ try:
+ return str(item)
+ except UnicodeError:
+ raise ValueError('Dictionary keys cannot contain non-ASCII '
+ 'characters on IronPython. Got %r.' % item)
+
class RemoteResult(object):
==============================================================================
Revision: f02bb7bd0980
Branch: default
Author: Pekka Klärck
Date: Thu Jan 9 17:07:21 2014 UTC
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=f02bb7bd0980
Modified:
/src/robot/libraries/Remote.py
=======================================
--- /src/robot/libraries/Remote.py Fri Jan 3 13:36:20 2014 UTC
+++ /src/robot/libraries/Remote.py Thu Jan 9 17:07:21 2014 UTC
@@ -27,6 +27,9 @@
from robot.utils import is_list_like, is_dict_like, unic
+IRONPYTHON = sys.platform == 'cli'
+
+
class Remote(object):
ROBOT_LIBRARY_SCOPE = 'TEST SUITE'
@@ -70,15 +73,16 @@
class ArgumentCoercer(object):
binary = re.compile('[\x00-\x08\x0B\x0C\x0E-\x1F]')
+ non_ascii = re.compile('[\x80-\xff]')
- def coerce(self, arg):
+ def coerce(self, argument):
for handles, handle in [(self._is_string, self._handle_string),
(self._is_number, self._pass_through),
(is_list_like, self._coerce_list),
(is_dict_like, self._coerce_dict),
(lambda arg: True, self._to_string)]:
- if handles(arg):
- return handle(arg)
+ if handles(argument):
+ return handle(argument)
def _is_string(self, arg):
return isinstance(arg, basestring)
@@ -87,12 +91,20 @@
return isinstance(arg, (int, long, float))
def _handle_string(self, arg):
- if not self.binary.search(arg):
- return arg
+ if self._contains_binary(arg):
+ return self._handle_binary(arg)
+ return arg
+
+ def _contains_binary(self, arg):
+ return (self.binary.search(arg) or
+ isinstance(arg, str) and not IRONPYTHON and
+ self.non_ascii.search(arg))
+
+ def _handle_binary(self, arg):
try:
arg = str(arg)
except UnicodeError:
- raise ValueError("Cannot represent %r as binary." % arg)
+ raise ValueError('Cannot represent %r as binary.' % arg)
return xmlrpclib.Binary(arg)
def _pass_through(self, arg):
@@ -102,13 +114,24 @@
return [self.coerce(item) for item in arg]
def _coerce_dict(self, arg):
- return dict((self._to_string(key), self.coerce(value))
- for key, value in arg.items())
+ return dict((self._to_key(key), self.coerce(arg[key])) for key in
arg)
+
+ def _to_key(self, item):
+ item = self._to_string(item)
+ if IRONPYTHON:
+ self._validate_key_on_ironpython(item)
+ return item
def _to_string(self, item):
- if item is None:
- return ''
- return unic(item)
+ item = unic(item) if item is not None else ''
+ return self._handle_string(item)
+
+ def _validate_key_on_ironpython(self, item):
+ try:
+ return str(item)
+ except UnicodeError:
+ raise ValueError('Dictionary keys cannot contain non-ASCII '
+ 'characters on IronPython. Got %r.' % item)
class RemoteResult(object):
--
---
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.