From 52322b0ad198844c6e2b9ed3e92b1112e5c5cb2b Mon Sep 17 00:00:00 2001 From: Amethyst Reese Date: Fri, 16 Sep 2022 20:00:18 -0700 Subject: [PATCH 1/3] Fixes to support Python 3.11 - proactively upconvert awaitables to tasks before calling asyncio.wait - skip the test exercising @asyncio.coroutine that is gone in 3.11 --- aioitertools/asyncio.py | 2 +- aioitertools/tests/helpers.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/aioitertools/asyncio.py b/aioitertools/asyncio.py index 65ff2ad..8cdef51 100644 --- a/aioitertools/asyncio.py +++ b/aioitertools/asyncio.py @@ -51,7 +51,7 @@ async def as_completed( """ done: Set[Awaitable[T]] = set() - pending: Set[Awaitable[T]] = set(aws) + pending: Set[Awaitable[T]] = {asyncio.ensure_future(a) for a in aws} remaining: Optional[float] = None if timeout and timeout > 0: diff --git a/aioitertools/tests/helpers.py b/aioitertools/tests/helpers.py index 519329d..f222177 100644 --- a/aioitertools/tests/helpers.py +++ b/aioitertools/tests/helpers.py @@ -3,7 +3,8 @@ import asyncio import functools -from unittest import TestCase +import sys +from unittest import skipIf, TestCase from aioitertools.helpers import deprecated_wait_param, maybe_await @@ -37,6 +38,7 @@ class HelpersTest(TestCase): self.assertEqual(await maybe_await(forty_two()), 42) + @skipIf(sys.version_info >= (3, 11), "@asyncio.coroutine removed") @async_test async def test_maybe_await_coroutine(self): @asyncio.coroutine From e17c4fbe70a0cb929146888cba9394198b683206 Mon Sep 17 00:00:00 2001 From: Amethyst Reese Date: Fri, 16 Sep 2022 20:01:50 -0700 Subject: [PATCH 2/3] Run CI on 3.11 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62ce981..897d77a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11.0-rc.1 - 3.11"] os: [macOS-latest, ubuntu-latest, windows-latest] steps: From 724f526604d97a2fa621eefc9cf03976ed3cd571 Mon Sep 17 00:00:00 2001 From: Amethyst Reese Date: Fri, 16 Sep 2022 20:39:29 -0700 Subject: [PATCH 3/3] Use newer coverage on 3.10+ --- requirements-dev.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 3e5f114..2b551e8 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,7 @@ attribution==1.5.2 black==22.8.0 -coverage[toml]==6.2 +coverage[toml]==6.2; python_version < "3.10" +coverage==6.4.4; python_version >= "3.10" flake8==5.0.4 flit==3.7.1 mypy==0.971