diff options
| author | Liguros - Gitlab CI/CD [develop] <gitlab@liguros.net> | 2026-04-12 19:11:06 +0000 |
|---|---|---|
| committer | Liguros - Gitlab CI/CD [develop] <gitlab@liguros.net> | 2026-04-12 19:11:06 +0000 |
| commit | 1a1f5db8827d7864f74b2f19b88aadd126b462d0 (patch) | |
| tree | 1bb31895b92ab571db3841f81faf6632157225ca /dev-python/simple-websocket | |
| parent | 00756a7495ccc0455ef2adbeb2237a02f1aa2629 (diff) | |
| download | baldeagleos-repo-1a1f5db8827d7864f74b2f19b88aadd126b462d0.tar.gz baldeagleos-repo-1a1f5db8827d7864f74b2f19b88aadd126b462d0.tar.xz baldeagleos-repo-1a1f5db8827d7864f74b2f19b88aadd126b462d0.zip | |
Adding metadata
Diffstat (limited to 'dev-python/simple-websocket')
| -rw-r--r-- | dev-python/simple-websocket/files/simple-websocket-1.1.0-py314.patch | 372 | ||||
| -rw-r--r-- | dev-python/simple-websocket/simple-websocket-1.1.0.ebuild | 8 |
2 files changed, 379 insertions, 1 deletions
diff --git a/dev-python/simple-websocket/files/simple-websocket-1.1.0-py314.patch b/dev-python/simple-websocket/files/simple-websocket-1.1.0-py314.patch new file mode 100644 index 000000000000..c20584d98c79 --- /dev/null +++ b/dev-python/simple-websocket/files/simple-websocket-1.1.0-py314.patch @@ -0,0 +1,372 @@ +diff --git a/tests/test_aioclient.py b/tests/test_aioclient.py +index 01a772a..5ec12ff 100644 +--- a/tests/test_aioclient.py ++++ b/tests/test_aioclient.py +@@ -1,15 +1,14 @@ + import asyncio +-import unittest + from unittest import mock + import pytest # noqa: F401 + + from wsproto.events import AcceptConnection, CloseConnection, TextMessage, \ + BytesMessage, Ping + import simple_websocket +-from .helpers import make_sync, AsyncMock + + +-class AioSimpleWebSocketClientTestCase(unittest.TestCase): ++@pytest.mark.asyncio ++class TestAioSimpleWebSocketClient: + async def get_client(self, mock_wsconn, url, events=[], subprotocols=None, + headers=None): + mock_wsconn().events.side_effect = \ +@@ -19,11 +18,10 @@ async def get_client(self, mock_wsconn, url, events=[], subprotocols=None, + return await simple_websocket.AioClient.connect( + url, subprotocols=subprotocols, headers=headers) + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_make_client(self, mock_wsconn, mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client(mock_wsconn, 'ws://example.com/ws?a=1') +@@ -40,12 +38,11 @@ async def test_make_client(self, mock_wsconn, mock_open_connection): + assert client.port == 80 + assert client.path == '/ws?a=1' + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_make_client_subprotocol(self, mock_wsconn, + mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client(mock_wsconn, 'ws://example.com/ws?a=1', +@@ -55,12 +52,11 @@ async def test_make_client_subprotocol(self, mock_wsconn, + b"Request(host='example.com', target='/ws?a=1', extensions=[], " + b"extra_headers=[], subprotocols=['foo'])") + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_make_client_subprotocols(self, mock_wsconn, + mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client(mock_wsconn, 'ws://example.com/ws?a=1', +@@ -70,12 +66,11 @@ async def test_make_client_subprotocols(self, mock_wsconn, + b"Request(host='example.com', target='/ws?a=1', extensions=[], " + b"extra_headers=[], subprotocols=['foo', 'bar'])") + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_make_client_headers(self, mock_wsconn, + mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client(mock_wsconn, 'ws://example.com/ws?a=1', +@@ -84,12 +79,11 @@ async def test_make_client_headers(self, mock_wsconn, + b"Request(host='example.com', target='/ws?a=1', extensions=[], " + b"extra_headers=[('Foo', 'Bar')], subprotocols=[])") + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_make_client_headers2(self, mock_wsconn, + mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client( +@@ -100,11 +94,10 @@ async def test_make_client_headers2(self, mock_wsconn, + b"extra_headers=[('Foo', 'Bar'), ('Foo', 'Baz')], " + b"subprotocols=[])") + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_send(self, mock_wsconn, mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client(mock_wsconn, 'ws://example.com/ws') +@@ -123,11 +116,10 @@ async def test_send(self, mock_wsconn, mock_open_connection): + b"Message(data=b'hello', frame_finished=True, " + b"message_finished=True)") + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive(self, mock_wsconn, mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client( +@@ -142,12 +134,11 @@ async def test_receive(self, mock_wsconn, mock_open_connection): + assert await client.receive() == b'hello' + assert await client.receive(timeout=0) is None + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive_after_close(self, mock_wsconn, + mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client( +@@ -160,11 +151,10 @@ async def test_receive_after_close(self, mock_wsconn, + with pytest.raises(simple_websocket.ConnectionClosed): + await client.receive() + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive_ping(self, mock_wsconn, mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) +@@ -176,11 +166,11 @@ async def test_receive_ping(self, mock_wsconn, mock_open_connection): + await asyncio.sleep(0.01) + wsock.write.assert_any_call(b"Pong(payload=b'hello')") + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive_empty(self, mock_wsconn, mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(side_effect=[b'x', b'x', b''])) ++ rsock = mock.MagicMock(read=mock.AsyncMock( ++ side_effect=[b'x', b'x', b''])) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client( +@@ -193,11 +183,10 @@ async def test_receive_empty(self, mock_wsconn, mock_open_connection): + assert await client.receive() == 'hello' + assert await client.receive(timeout=0) is None + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_close(self, mock_wsconn, mock_open_connection): +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + client = await self.get_client( +diff --git a/tests/test_aioserver.py b/tests/test_aioserver.py +index a274019..071e035 100644 +--- a/tests/test_aioserver.py ++++ b/tests/test_aioserver.py +@@ -1,15 +1,14 @@ + import asyncio +-import unittest + from unittest import mock + import pytest # noqa: F401 + + from wsproto.events import Request, CloseConnection, TextMessage, \ + BytesMessage, Ping, Pong + import simple_websocket +-from .helpers import make_sync, AsyncMock + + +-class AioSimpleWebSocketServerTestCase(unittest.TestCase): ++@pytest.mark.asyncio ++class TestAioSimpleWebSocketServer: + async def get_server(self, mock_wsconn, request, events=[], + client_subprotocols=None, server_subprotocols=None, + **kwargs): +@@ -29,12 +28,11 @@ async def get_server(self, mock_wsconn, request, events=[], + return await simple_websocket.AioServer.accept( + aiohttp=request, subprotocols=server_subprotocols, **kwargs) + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_aiohttp(self, mock_wsconn, mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request) +@@ -53,19 +51,17 @@ async def test_aiohttp(self, mock_wsconn, mock_open_connection): + b'Sec-Websocket-Version: 13\r\n\r\n') + assert server.is_server + +- @make_sync + async def test_invalid_request(self): + with pytest.raises(ValueError): + await simple_websocket.AioServer.accept(aiohttp='foo', asgi='bar') + with pytest.raises(ValueError): + await simple_websocket.AioServer.accept(asgi='bar', sock='baz') + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_send(self, mock_wsconn, mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request) +@@ -84,12 +80,11 @@ async def test_send(self, mock_wsconn, mock_open_connection): + b"Message(data=b'hello', frame_finished=True, " + b"message_finished=True)") + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive(self, mock_wsconn, mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request, events=[ +@@ -103,13 +98,12 @@ async def test_receive(self, mock_wsconn, mock_open_connection): + assert await server.receive() == b'hello' + assert await server.receive(timeout=0) is None + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive_after_close(self, mock_wsconn, + mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request, events=[ +@@ -121,13 +115,12 @@ async def test_receive_after_close(self, mock_wsconn, + with pytest.raises(simple_websocket.ConnectionClosed): + await server.receive() + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive_split_messages(self, mock_wsconn, + mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request, events=[ +@@ -151,12 +144,11 @@ async def test_receive_split_messages(self, mock_wsconn, + assert await server.receive() == b'hello' + assert await server.receive(timeout=0) is None + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive_ping(self, mock_wsconn, mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request, events=[ +@@ -166,12 +158,11 @@ async def test_receive_ping(self, mock_wsconn, mock_open_connection): + await asyncio.sleep(0.01) + wsock.write.assert_any_call(b"Pong(payload=b'hello')") + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive_empty(self, mock_wsconn, mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request, events=[ +@@ -183,12 +174,11 @@ async def test_receive_empty(self, mock_wsconn, mock_open_connection): + assert await server.receive() == 'hello' + assert await server.receive(timeout=0) is None + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_receive_large(self, mock_wsconn, mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request, events=[ +@@ -201,12 +191,11 @@ async def test_receive_large(self, mock_wsconn, mock_open_connection): + assert await server.receive() == 'hello' + assert await server.receive(timeout=0) is None + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_close(self, mock_wsconn, mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request) +@@ -222,7 +211,6 @@ async def test_close(self, mock_wsconn, mock_open_connection): + b'CloseConnection(code=<CloseReason.NORMAL_CLOSURE: 1000>, ' + b'reason=None)') + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + @mock.patch('simple_websocket.aiows.time') +@@ -230,7 +218,7 @@ async def test_close(self, mock_wsconn, mock_open_connection): + async def test_ping_pong(self, mock_wait_for, mock_time, mock_wsconn, + mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock()) ++ rsock = mock.MagicMock(read=mock.AsyncMock()) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + server = await self.get_server(mock_wsconn, mock_request, events=[ +@@ -246,12 +234,11 @@ async def test_ping_pong(self, mock_wait_for, mock_time, mock_wsconn, + assert wsock.write.call_args_list[2][0][0].startswith(b'Ping') + assert wsock.write.call_args_list[3][0][0].startswith(b'Close') + +- @make_sync + @mock.patch('simple_websocket.aiows.asyncio.open_connection') + @mock.patch('simple_websocket.aiows.WSConnection') + async def test_subprotocols(self, mock_wsconn, mock_open_connection): + mock_request = mock.MagicMock(headers={}) +- rsock = mock.MagicMock(read=AsyncMock(return_value=b'x')) ++ rsock = mock.MagicMock(read=mock.AsyncMock(return_value=b'x')) + wsock = mock.MagicMock() + mock_open_connection.return_value = (rsock, wsock) + +diff --git a/tests/test_server.py b/tests/test_server.py +index 7be5d15..ca5fe99 100644 +--- a/tests/test_server.py ++++ b/tests/test_server.py +@@ -92,7 +92,7 @@ def test_send(self, mock_wsconn): + b"message_finished=True)") + server.connected = True + server.send(b'hello') +- mock_socket.send.assert_called_with( ++ mock_socket.send.assert_any_call( + b"Message(data=b'hello', frame_finished=True, " + b"message_finished=True)") + diff --git a/dev-python/simple-websocket/simple-websocket-1.1.0.ebuild b/dev-python/simple-websocket/simple-websocket-1.1.0.ebuild index 7552aa5481a1..2d79417b7ce5 100644 --- a/dev-python/simple-websocket/simple-websocket-1.1.0.ebuild +++ b/dev-python/simple-websocket/simple-websocket-1.1.0.ebuild @@ -1,4 +1,4 @@ -# Copyright 2023-2025 Gentoo Authors +# Copyright 2023-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -29,6 +29,11 @@ RDEPEND=" " src_prepare() { + local PATCHES=( + # https://github.com/miguelgrinberg/simple-websocket/pull/48 + "${FILESDIR}/${P}-py314.patch" + ) + distutils-r1_src_prepare # fix tests to work offline @@ -36,4 +41,5 @@ src_prepare() { sed -i -e 's:example\.com:localhost:g' tests/test_client.py || die } +EPYTEST_PLUGINS=( pytest-asyncio ) distutils_enable_tests pytest |
