Skip to content

Update test suite to match latest Robot and Python versions #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2022

Conversation

JFoederer
Copy link
Contributor

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.

Fixes all but 1 test, but only under the condition that also the _convert method in Robot's Remote.py is update to automatically convert bytes to unicode whenever possible.

Without updating Robot's Remote.py 5 tests still fail.
@pekkaklarck
Copy link
Member

Looks good to me.

@pekkaklarck pekkaklarck merged commit d4f3e47 into robotframework:master Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants