Skip to content

Python 3.11 compatibility #4401

Closed
Closed

Description

@pekkaklarck

Python 3.11 is getting ready and we need to test that RF 5.1 is compatible with it. That requires:

  • Running all tests with the latest Python 3.11 version (beta 4 at the moment) both on Linux.
  • Same as above on Windows.
  • Fixing possible issues.
  • Adding Python 3.11 support to project metadata in setup.py.
  • Enabling Python 3.11 runs on CI (assuming it is already supported there).

Activity

  1. added this to the v5.1 milestone on Jul 12, 2022
  2. pekkaklarck commented on Jul 12, 2022

    @pekkaklarck
    MemberAuthor

    Some tests failed. I analyzed why they failed and these were the reasons:

    1. Python 3.11 has enhanced error reporting and as a part of that tracebacks have ^^^^ markers showing where errors occur in more detail. This breaks some unit tests, but they are easy to fix by filtering such lines away from tracebacks before comparing them.
    2. typing.get_type_hints doesn't anymore automatically add None to the returned types if an argument has None as a default value. This means that if you have a keyword with a signature like arg: str = None, arg only has str as a type nowadays when earlier it had both str and None (i.e. NoneType). This means that if you call the keyword with a None object, it is not anymore accepted as-is but instead converted to a string None. I don't like out conversion behavior depending on Python versions, so I'll adapt the code so that None isn't converted if an argument has None as a default.
    3. Python 3.11 is more strict about embedding flags to regexp patterns. With earlier versions, for example, ^(?s)x works but it causes an error with Python 3.11. Luckily the only place in the code this error occurs isString.Get Lines Matching Regexp keyword and fixing it is easy.
  3. pekkaklarck commented on Jul 12, 2022

    @pekkaklarck
    MemberAuthor

    This is now done.

    Getting tests to pass on CI turned out to be somewhat hard. Strangely more tests validating tracebacks failed on CI due to those ^^^ lines added by Python 3.11. CI uses beta 3 while I tested locally with beta 4, but it would be a strange if that affected this behavior. Anyway, I got tests passing also on CI by removing ^^^ lines.

    Also needed to disable testing using Python 3.11 on Windows. Too many dependencies lacked Python 3.11 support.

  4. ShemTovYosef commented on Oct 19, 2022

    @ShemTovYosef

    Hi @pekkaklarck

    We want to move to python 3.11 and are currently blocked due to this issue: robotframework/PythonRemoteServer#78
    Do you have any plans for it?

  5. pekkaklarck commented on Oct 19, 2022

    @pekkaklarck
    MemberAuthor

    PythonRemoteServer has been neglected for too long. Now that RF 6.0 is out, I ought to have time to look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions