From: Subject: Debian changes The Debian packaging of python-aionut is maintained in git, using a workflow similar to the one described in dgit-maint-merge(7). The Debian delta is represented by this one combined patch; there isn't a patch queue that can be represented as a quilt series. A detailed breakdown of the changes is available from their canonical representation -- git commits in the packaging repository. For example, to see the changes made by the Debian maintainer in the first upload of upstream version 1.2.3, you could use: % git clone https://git.dgit.debian.org/python-aionut % cd python-aionut % git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian' (If you have dgit, use `dgit clone python-aionut`, rather than plain `git clone`.) We don't use debian/source/options single-debian-patch because it has bugs. Therefore, NMUs etc. may nevertheless have made additional patches. --- diff --git a/tests/test_init.py b/tests/test_init.py index 6b421f5..abf8d15 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -5,6 +5,7 @@ import socket from asyncio.streams import StreamReader, StreamWriter import pytest +import pytest_asyncio from aionut import ( AIONUTClient, @@ -32,30 +33,31 @@ _CLIENTS: set[AIONUTClient] = set() _SERVERS: set[tuple[asyncio.Server, asyncio.Task[None], socket.socket]] = set() -@pytest.fixture(autouse=True) +@pytest_asyncio.fixture(autouse=True) async def cleanup(): yield await asyncio.sleep(0) _LOGGER.debug("cleanup") - for client in _CLIENTS: - writer = client._writer - assert writer - writer.write_eof() - await writer.drain() - client.shutdown() - await writer.wait_closed() - for server, task, sock in _SERVERS: - server.close() - await server.wait_closed() - sock.close() - for sock in server.sockets: - sock.close() - task.cancel() - with contextlib.suppress(asyncio.CancelledError): - await task - await asyncio.sleep(0) - _CLIENTS.clear() - _SERVERS.clear() + try: + for client in _CLIENTS: + writer = client._writer + client.shutdown() + if writer is not None: + writer.close() + with contextlib.suppress(ConnectionError, TimeoutError): + await asyncio.wait_for(writer.wait_closed(), timeout=1) + for server, task, sock in _SERVERS: + server.close() + await server.wait_closed() + with contextlib.suppress(OSError): + sock.close() + task.cancel() + with contextlib.suppress(asyncio.CancelledError): + await task + await asyncio.sleep(0) + finally: + _CLIENTS.clear() + _SERVERS.clear() def make_nut_client(