diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51b6a79..eace0fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,16 +85,26 @@ 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 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: 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. diff --git a/async_timeout/__init__.py b/async_timeout/__init__.py index 4649d24..a1754b7 100644 --- a/async_timeout/__init__.py +++ b/async_timeout/__init__.py @@ -1,12 +1,8 @@ import asyncio import enum 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): @@ -107,24 +103,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 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)