Skip to content
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

Added Python 3.11 support #1111

Merged
merged 1 commit into from Jan 9, 2023
Merged

Conversation

qstokkink
Copy link
Collaborator

@qstokkink qstokkink commented Dec 22, 2022

Fixes #1110

This PR:

  • Adds an __all__ definition for base.py to avoid exporting newly added module-level variables.
  • Adds TestBase support for Python 3.11 using unittest.IsolatedAsyncioTestCase.
  • Fixes RandomChurn using random.sample on a set (only list is supported as of Python 3.11).

See original issue for implementation substantiation. Other notes:

  • TestBase now inherits from unittest.IsolatedAsyncioTestCase for all Python versions >= 3.8 by default. However, asynctest is still supported up to Python 3.10 and TestBase subclasses can switch to asynctest by setting __asynctest_compatibility_mode__ to True.
  • loop has a class scope in asynctest, an instance scope in unittest, and it needs to be retrieved upon invocation (a property) for Python 3.11.
  • _callSetUp and _callTearDown are overwritten to support the old TestBase behavior of allowing both async def and def setup and teardowns, including its own. For (only) the teardown of TestBase, the asyncTearDown is still explicitly needed.

@qstokkink qstokkink force-pushed the add_311_support branch 3 times, most recently from d93f82a to e8fc964 Compare December 24, 2022 10:06
@qstokkink
Copy link
Collaborator Author

validate

@qstokkink qstokkink marked this pull request as ready for review December 24, 2022 10:50
@qstokkink qstokkink changed the title WIP: Added Python 3.11 support READY: Added Python 3.11 support Dec 24, 2022
@qstokkink qstokkink changed the title READY: Added Python 3.11 support Added Python 3.11 support Jan 9, 2023
@qstokkink qstokkink merged commit 8dc6a13 into Tribler:master Jan 9, 2023
@qstokkink qstokkink deleted the add_311_support branch January 9, 2023 10:24
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.

Python 3.11 asynctest support
2 participants