Please review this pull request and provide relevant feedback on how to properly fix all tests to reastablish a safe starting point for further modifications.
I am looking into issue #3362 of Robot framework about loading large keyword libraries. Prototypes are looking promising, but before making any real changes to either side of the interface I need a good set of tests to work from as a base for delivering quality.
The changes in this current pull request are about getting up-to-date with latest versions of Robot and Python. They either fix all but 1 or all but 5 tests, depending on the favoured approach. Remaining failures are caused by bytes versus unicode conflicts and I was unable to find a solution that works in all situations.
Option 1: Remaining failures 1
This requires a change in the _convert() method in Robot's Remote.py. This will, whenever possible, automatically convert bytes to unicode. The remaining failure is a test case that intentionally sends unicode as bytes type. With automatic conversion this will not be received as bytes, but as unicode.
def _convert(self, value):
if isinstance(value, xmlrpclib.Binary):
try: ###########
return bytes(value.data).decode() # New bit
except: #
return bytes(value.data)
if is_dict_like(value):
return DotDict((k, self._convert(v)) for k, v in value.items())
if is_list_like(value):
return [self._convert(v) for v in value]
return value
Option 2: Remaining failures 5
This is without updating anything on Robot side, so without the new bit. I was unable to find a solution to distinguish between the intention of bytes or unicode, so this is the opposite solution to option 1. Bytes are always passed on as bytes, no conversion. This does however mean that the receiving side will need to deal with this on library level.
Of course I would even more appreciate if someone came up with a third options that cleanly separates the two intentions. Please share your thoughts.
Please review this pull request and provide relevant feedback on how to properly fix all tests to reastablish a safe starting point for further modifications.
I am looking into issue #3362 of Robot framework about loading large keyword libraries. Prototypes are looking promising, but before making any real changes to either side of the interface I need a good set of tests to work from as a base for delivering quality.
The changes in this current pull request are about getting up-to-date with latest versions of Robot and Python. They either fix all but 1 or all but 5 tests, depending on the favoured approach. Remaining failures are caused by bytes versus unicode conflicts and I was unable to find a solution that works in all situations.
Option 1: Remaining failures 1 This requires a change in the
_convert()
method in Robot'sRemote.py
. This will, whenever possible, automatically convert bytes to unicode. The remaining failure is a test case that intentionally sends unicode as bytes type. With automatic conversion this will not be received as bytes, but as unicode.Option 2: Remaining failures 5 This is without updating anything on Robot side, so without the new bit. I was unable to find a solution to distinguish between the intention of bytes or unicode, so this is the opposite solution to option 1. Bytes are always passed on as bytes, no conversion. This does however mean that the receiving side will need to deal with this on library level.
Of course I would even more appreciate if someone came up with a third options that cleanly separates the two intentions. Please share your thoughts.