Skip to content

Commit

Permalink
refactor!: Bump aiohttp & async-timeout deps lower bounds (#105)
Browse files Browse the repository at this point in the history
As well as ensure that timeout context manager is an async one, not
sync.

On top of that fix warnings for `event_loop` fixture in tests and
`async_mode`.

Fixes: #81
  • Loading branch information
playpauseandstop authored Jun 22, 2022
1 parent 769263b commit 3626f16
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ aiohttp-middlewares
Collection of useful middlewares for `aiohttp.web`_ applications.

- Works on `Python`_ 3.7+
- Works with `aiohttp.web`_ 3.7+
- Works with `aiohttp.web`_ 3.8.1+
- BSD licensed
- Latest documentation `on Read The Docs
<https://aiohttp-middlewares.readthedocs.io/>`_
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.7"
aiohttp = "^3.7.0"
async-timeout = ">=3.0,<5.0"
aiohttp = "^3.8.1"
async-timeout = "^4.0.2"
yarl = "^1.5.1"

[tool.poetry.dev-dependencies]
Expand All @@ -95,13 +95,15 @@ coveralls = "^3.3.1"
mypy = "^0.961"
pytest = "^7.1.2"
pytest-aiohttp = "^1.0.4"
pytest-asyncio = "^0.18.3"
pytest-cov = "^3.0.0"

[tool.pytest.ini_options]
minversion = "6.2.5"
minversion = "7.1.2"
addopts = "--cov --no-cov-on-fail"
testpaths = ["./tests/"]
log_level = "info"
asyncio_mode = "auto"

[tool.tox]
legacy_tox_ini = """
Expand Down Expand Up @@ -133,7 +135,7 @@ commands =
[testenv:py310-minimum-requirements]
commands_pre =
poetry install
poetry run python3 -m pip install aiohttp==3.7.0 async-timeout==3.0.0 yarl==1.5.1
poetry run python3 -m pip install aiohttp==3.8.1 async-timeout==4.0.2 yarl==1.5.1
"""

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion src/aiohttp_middlewares/timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def middleware(
)
return await handler(request)

with timeout(seconds):
async with timeout(seconds):
return await handler(request)

return middleware
4 changes: 2 additions & 2 deletions tests/test_shield_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def test_shield_request_by_url(aiohttp_client, url, method):
"method, value",
[("DELETE", False), ("GET", False), ("POST", True), ("PUT", False)],
)
async def test_shield_middleware_funcitonal(loop, method, value):
async def test_shield_middleware_funcitonal(event_loop, method, value):
flag = False
client_ready = asyncio.Event()
handler_ready = asyncio.Event()
Expand All @@ -106,7 +106,7 @@ async def handler(request):

# Run handler in a task.
middleware = shield_middleware(methods=frozenset({"POST"}))
task = loop.create_task(
task = event_loop.create_task(
middleware(make_mocked_request(method, "/"), handler)
)
await handler_ready.wait()
Expand Down

0 comments on commit 3626f16

Please sign in to comment.