From 43b08c88def8ef3088e4f1e17570ca51b129eeac Mon Sep 17 00:00:00 2001 From: Jonathan Ehwald Date: Sat, 14 Dec 2024 00:42:39 +0100 Subject: [PATCH 1/3] Fix missing test markers --- tests/channels/test_layers.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/channels/test_layers.py b/tests/channels/test_layers.py index b0a2960242..a9c325f8e8 100644 --- a/tests/channels/test_layers.py +++ b/tests/channels/test_layers.py @@ -58,6 +58,7 @@ async def test_no_layers(): pass +@pytest.mark.django_db async def test_channel_listen(ws: WebsocketCommunicator): from channels.layers import get_channel_layer @@ -107,6 +108,7 @@ async def test_channel_listen(ws: WebsocketCommunicator): await ws.send_json_to(CompleteMessage({"id": "sub1", "type": "complete"})) +@pytest.mark.django_db async def test_channel_listen_with_confirmation(ws: WebsocketCommunicator): from channels.layers import get_channel_layer @@ -162,6 +164,7 @@ async def test_channel_listen_with_confirmation(ws: WebsocketCommunicator): await ws.send_json_to(CompleteMessage({"id": "sub1", "type": "complete"})) +@pytest.mark.django_db async def test_channel_listen_timeout(ws: WebsocketCommunicator): from channels.layers import get_channel_layer @@ -195,6 +198,7 @@ async def test_channel_listen_timeout(ws: WebsocketCommunicator): assert complete_message == {"id": "sub1", "type": "complete"} +@pytest.mark.django_db async def test_channel_listen_timeout_cm(ws: WebsocketCommunicator): from channels.layers import get_channel_layer @@ -234,6 +238,7 @@ async def test_channel_listen_timeout_cm(ws: WebsocketCommunicator): assert complete_message == {"id": "sub1", "type": "complete"} +@pytest.mark.django_db async def test_channel_listen_no_message_on_channel(ws: WebsocketCommunicator): from channels.layers import get_channel_layer @@ -275,6 +280,7 @@ async def test_channel_listen_no_message_on_channel(ws: WebsocketCommunicator): assert complete_message == {"id": "sub1", "type": "complete"} +@pytest.mark.django_db async def test_channel_listen_no_message_on_channel_cm(ws: WebsocketCommunicator): from channels.layers import get_channel_layer @@ -322,6 +328,7 @@ async def test_channel_listen_no_message_on_channel_cm(ws: WebsocketCommunicator assert complete_message == {"id": "sub1", "type": "complete"} +@pytest.mark.django_db async def test_channel_listen_group(ws: WebsocketCommunicator): from channels.layers import get_channel_layer @@ -390,6 +397,7 @@ async def test_channel_listen_group(ws: WebsocketCommunicator): await ws.send_json_to(CompleteMessage({"id": "sub1", "type": "complete"})) +@pytest.mark.django_db async def test_channel_listen_group_cm(ws: WebsocketCommunicator): from channels.layers import get_channel_layer @@ -464,6 +472,7 @@ async def test_channel_listen_group_cm(ws: WebsocketCommunicator): await ws.send_json_to(CompleteMessage({"id": "sub1", "type": "complete"})) +@pytest.mark.django_db async def test_channel_listen_group_twice(ws: WebsocketCommunicator): from channels.layers import get_channel_layer From d1eeb12ac6a4ee6be721f7f4b43a638cbd260607 Mon Sep 17 00:00:00 2001 From: Jonathan Ehwald Date: Sat, 14 Dec 2024 00:52:55 +0100 Subject: [PATCH 2/3] Fix missing assert --- tests/extensions/test_pyinstrument.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/extensions/test_pyinstrument.py b/tests/extensions/test_pyinstrument.py index 91441ea77e..ebb0135ac6 100644 --- a/tests/extensions/test_pyinstrument.py +++ b/tests/extensions/test_pyinstrument.py @@ -41,6 +41,7 @@ def the_field(self) -> int: content = report_file_path.read_text("utf-8") assert not result.errors + assert result.data assert result.data["theField"] == 4 assert "function_called_by_us_a" in content From 75082378ed69de1f99c344d97d62222282d0de6f Mon Sep 17 00:00:00 2001 From: Jonathan Ehwald Date: Sat, 14 Dec 2024 00:56:34 +0100 Subject: [PATCH 3/3] Fix violation of opening rules on windows --- tests/extensions/test_pyinstrument.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/extensions/test_pyinstrument.py b/tests/extensions/test_pyinstrument.py index ebb0135ac6..067c8e9951 100644 --- a/tests/extensions/test_pyinstrument.py +++ b/tests/extensions/test_pyinstrument.py @@ -22,7 +22,7 @@ def function_called_by_us_c(): def test_basic_pyinstrument(): - with tempfile.NamedTemporaryFile() as report_file: + with tempfile.NamedTemporaryFile(delete=False) as report_file: report_file_path = Path(report_file.name) @strawberry.type