From 402909e887022f3f24ffc856209638d79c6bfe97 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 31 Oct 2024 12:06:38 +0100 Subject: [PATCH 1/7] Drop deprecated sync context manager support --- async_timeout/__init__.py | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/async_timeout/__init__.py b/async_timeout/__init__.py index 4649d24..1fdbbf6 100644 --- a/async_timeout/__init__.py +++ b/async_timeout/__init__.py @@ -3,10 +3,7 @@ import sys import warnings from types import TracebackType -from typing import Optional, Type - - -from typing import final +from typing import Optional, Type, final if sys.version_info >= (3, 11): @@ -20,7 +17,7 @@ def _uncancel_task(task: "asyncio.Task[object]") -> None: pass -__version__ = "4.0.3" +__version__ = "5.0.0" __all__ = ("timeout", "timeout_at", "Timeout") @@ -107,24 +104,6 @@ def __init__( else: self.update(deadline) - def __enter__(self) -> "Timeout": - warnings.warn( - "with timeout() is deprecated, use async with timeout() instead", - DeprecationWarning, - stacklevel=2, - ) - self._do_enter() - return self - - def __exit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> Optional[bool]: - self._do_exit(exc_type) - return None - async def __aenter__(self) -> "Timeout": self._do_enter() return self From 9cc66acbae569884fb83b4294e911bf6be6c1447 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 31 Oct 2024 12:08:13 +0100 Subject: [PATCH 2/7] fix --- async_timeout/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/async_timeout/__init__.py b/async_timeout/__init__.py index 1fdbbf6..6289034 100644 --- a/async_timeout/__init__.py +++ b/async_timeout/__init__.py @@ -17,7 +17,7 @@ def _uncancel_task(task: "asyncio.Task[object]") -> None: pass -__version__ = "5.0.0" +__version__ = "4.0.3" __all__ = ("timeout", "timeout_at", "Timeout") From f26bf3a6193badd28e17be81585e648d73f4aec2 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 31 Oct 2024 12:11:30 +0100 Subject: [PATCH 3/7] Add changelog --- CHANGES/421.removal.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 CHANGES/421.removal.rst diff --git a/CHANGES/421.removal.rst b/CHANGES/421.removal.rst new file mode 100644 index 0000000..845b6f6 --- /dev/null +++ b/CHANGES/421.removal.rst @@ -0,0 +1 @@ +Drop deprecated sync context manager support, use ``async with timeout(...): ...`` instead. From 52c4caa70db39b1f431328eee8d22ebfaeb3b5d1 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 31 Oct 2024 12:11:53 +0100 Subject: [PATCH 4/7] fix --- async_timeout/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/async_timeout/__init__.py b/async_timeout/__init__.py index 6289034..a1754b7 100644 --- a/async_timeout/__init__.py +++ b/async_timeout/__init__.py @@ -1,7 +1,6 @@ import asyncio import enum import sys -import warnings from types import TracebackType from typing import Optional, Type, final From f8feb8deffd91ecac108606cb277e94890af0bc3 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 31 Oct 2024 12:13:36 +0100 Subject: [PATCH 5/7] Tune CI matrix --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51b6a79..0456b56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,10 +91,20 @@ jobs: flags: unit fail_ci_if_error: false + test-summary: + if: always() + needs: [lint, test] + runs-on: ubuntu-latest + steps: + - name: Test matrix status + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} + deploy: name: Deploy runs-on: ubuntu-latest - needs: test + needs: test-summary # Run only on pushing a tag if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') steps: From 8fdd93699b54698c2a510da6906cc547b6f4ee6d Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 31 Oct 2024 12:16:51 +0100 Subject: [PATCH 6/7] Fix --- tests/test_timeout.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/test_timeout.py b/tests/test_timeout.py index 7c687ac..b19c45d 100644 --- a/tests/test_timeout.py +++ b/tests/test_timeout.py @@ -360,10 +360,3 @@ async def test_enter_twice() -> None: with pytest.raises(RuntimeError, match="invalid state EXIT"): async with t: await asyncio.sleep(0) - - -@pytest.mark.asyncio -async def test_deprecated_with() -> None: - with pytest.warns(DeprecationWarning): - with timeout(1): - await asyncio.sleep(0) From 0e515a9ff115ff0338c72a1761268e123312c226 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 31 Oct 2024 12:20:32 +0100 Subject: [PATCH 7/7] fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0456b56..eace0fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: python -m pytest tests python -m coverage xml - name: Upload coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: ./coverage.xml flags: unit