Skip to content

Commit 8b09480

Browse files
authored
Merge pull request #682 from mosquito/aiormq-update
aiormq>=6.8,<7
2 parents d5fb8c2 + faaa81e commit 8b09480

File tree

12 files changed

+922
-765
lines changed

12 files changed

+922
-765
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ jobs:
5656

5757
matrix:
5858
python:
59-
- '3.9'
6059
- '3.10'
6160
- '3.11'
6261
- '3.12'

aio_pika/robust_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
log = get_logger(__name__)
2424

2525

26-
class RobustChannel(Channel, AbstractRobustChannel): # type: ignore
26+
class RobustChannel(Channel, AbstractRobustChannel):
2727
""" Channel abstraction """
2828

2929
QUEUE_CLASS: Type[Queue] = RobustQueue

aio_pika/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def ensure_awaitable(
336336

337337
@wraps(func)
338338
async def wrapper(*args: _Params.args, **kwargs: _Params.kwargs) -> T:
339-
nonlocal func
339+
nonlocal func # noqa
340340

341341
result = func(*args, **kwargs)
342342
if not hasattr(result, "__await__"):

poetry.lock

Lines changed: 912 additions & 723 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "aio-pika"
3-
version = "9.5.6"
3+
version = "9.5.7"
44
description = "Wrapper around the aiormq for asyncio and humans"
55
authors = ["Dmitry Orlov <me@mosquito.su>"]
66
readme = "README.rst"
@@ -15,7 +15,6 @@ classifiers = [
1515
"Operating System :: Microsoft",
1616
"Operating System :: POSIX",
1717
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python :: 3.9",
1918
"Programming Language :: Python :: 3.10",
2019
"Programming Language :: Python :: 3.11",
2120
"Programming Language :: Python :: 3.12",
@@ -36,8 +35,8 @@ packages = [{ include = "aio_pika" }]
3635
"Documentation" = "https://docs.aio-pika.com/"
3736

3837
[tool.poetry.dependencies]
39-
python = "^3.9"
40-
aiormq = "~6.8"
38+
python = "^3.10"
39+
aiormq = "^6.8"
4140
yarl = [{ version = '*'}]
4241
exceptiongroup = [{ version = "^1", python = "< 3.11" }]
4342
typing-extensions = [{ version = '*', python = "< 3.10" }]

tests/conftest.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ async def add_cleanup(event_loop):
2222
entities = []
2323

2424
def payload(func, *args, **kwargs):
25-
nonlocal entities
2625
func = partial(awaitable(func), *args, **kwargs)
2726
entities.append(func)
2827

@@ -40,7 +39,6 @@ async def create_task(event_loop):
4039
tasks = []
4140

4241
def payload(coroutine):
43-
nonlocal tasks
4442
task = event_loop.create_task(coroutine)
4543
tasks.append(task)
4644
return task
@@ -145,8 +143,6 @@ def create_channel(connection: aio_pika.Connection, add_cleanup):
145143
conn = connection
146144

147145
async def fabric(cleanup=True, connection=None, *args, **kwargs):
148-
nonlocal add_cleanup, conn
149-
150146
if connection is None:
151147
connection = conn
152148

@@ -182,8 +178,6 @@ def declare_queue(connection, channel, add_cleanup):
182178
async def fabric(
183179
*args, cleanup=True, channel=None, **kwargs,
184180
) -> aio_pika.Queue:
185-
nonlocal ch, add_cleanup
186-
187181
if channel is None:
188182
channel = ch
189183

@@ -204,8 +198,6 @@ def declare_exchange(connection, channel, add_cleanup):
204198
async def fabric(
205199
*args, channel=None, cleanup=True, **kwargs,
206200
) -> aio_pika.Exchange:
207-
nonlocal ch, add_cleanup
208-
209201
if channel is None:
210202
channel = ch
211203

tests/test_amqp.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def on_close(
6363
ch: Optional[aio_pika.abc.AbstractChannel],
6464
exc: Optional[BaseException] = None,
6565
):
66-
nonlocal event, closed
66+
nonlocal closed
6767
log.info("Close called")
6868
closed = True
6969
assert ch is not None
@@ -1450,10 +1450,7 @@ async def test_queue_iterator_close_was_called_twice(
14501450
iterator: QueueIterator
14511451

14521452
async def task_inner():
1453-
nonlocal event
14541453
nonlocal iterator
1455-
nonlocal create_connection
1456-
14571454
connection = await create_connection()
14581455

14591456
async with connection:
@@ -1488,10 +1485,6 @@ async def test_queue_iterator_close_with_noack(
14881485
body = get_random_name("test_body").encode()
14891486

14901487
async def task_inner():
1491-
nonlocal messages
1492-
nonlocal create_connection
1493-
nonlocal add_cleanup
1494-
14951488
connection = await create_connection()
14961489
add_cleanup(connection.close)
14971490

tests/test_amqp_robust.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def create_connection(connection_fabric, event_loop, amqp_url):
2323
return partial(connection_fabric, amqp_url, loop=event_loop)
2424

2525

26-
class TestCaseNoRobust(TestCaseAmqp):
26+
class TestCaseNoRobust(TestCaseAmqp): # type: ignore
2727
PARAMS = [{"robust": True}, {"robust": False}]
2828
IDS = ["robust=1", "robust=0"]
2929

3030
@staticmethod
3131
@pytest.fixture(name="declare_queue", params=PARAMS, ids=IDS)
32-
def declare_queue_(request, declare_queue):
32+
def declare_queue_(request, declare_queue): # type: ignore
3333
async def fabric(*args, **kwargs) -> aio_pika.Queue:
3434
kwargs.update(request.param)
3535
return await declare_queue(*args, **kwargs)
@@ -38,7 +38,7 @@ async def fabric(*args, **kwargs) -> aio_pika.Queue:
3838

3939
@staticmethod
4040
@pytest.fixture(name="declare_exchange", params=PARAMS, ids=IDS)
41-
def declare_exchange_(request, declare_exchange):
41+
def declare_exchange_(request, declare_exchange): # type: ignore
4242
async def fabric(*args, **kwargs) -> aio_pika.Queue:
4343
kwargs.update(request.param)
4444
return await declare_exchange(*args, **kwargs)

tests/test_amqp_robust_proxy.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ async def test_robust_reconnect(
180180
consumer_event = asyncio.Event()
181181

182182
async def reader(queue_name):
183-
nonlocal shared
184-
185183
try:
186184
queue = await read_channel.declare_queue(
187185
name=queue_name, passive=True,
@@ -377,8 +375,6 @@ async def test_robust_duplicate_queue(
377375

378376
# noinspection PyShadowingNames
379377
async def reader(queue: aio_pika.Queue):
380-
nonlocal shared
381-
382378
async with queue.iterator() as q:
383379
async for message in q:
384380
# https://www.rabbitmq.com/confirms.html#automatic-requeueing

tests/test_master.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ async def test_simple(self, channel: aio_pika.Channel):
1717
self.state: List[Any] = []
1818

1919
def worker_func(*, foo, bar):
20-
nonlocal event
2120
self.state.append((foo, bar))
2221
event.set()
2322

@@ -40,7 +39,6 @@ async def test_simple_coro(self, channel: aio_pika.Channel):
4039
self.state = []
4140

4241
async def worker_func(*, foo, bar):
43-
nonlocal event
4442
self.state.append((foo, bar))
4543
event.set()
4644

@@ -63,8 +61,7 @@ async def test_simple_many(self, channel: aio_pika.Channel):
6361
state = []
6462

6563
def worker_func(*, foo):
66-
nonlocal tasks, state
67-
64+
nonlocal tasks
6865
state.append(foo)
6966
tasks -= 1
7067

0 commit comments

Comments
 (0)