aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/websocket-client/py3
diff options
context:
space:
mode:
authormaxim-yurchuk <maxim-yurchuk@yandex-team.com>2024-10-09 12:29:46 +0300
committermaxim-yurchuk <maxim-yurchuk@yandex-team.com>2024-10-09 13:14:22 +0300
commit9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch)
treea8fb3181d5947c0d78cf402aa56e686130179049 /contrib/python/websocket-client/py3
parenta44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff)
downloadydb-9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80.tar.gz
publishFullContrib: true for ydb
<HIDDEN_URL> commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/websocket-client/py3')
-rw-r--r--contrib/python/websocket-client/py3/patches/01-fix-tests.patch24
-rw-r--r--contrib/python/websocket-client/py3/websocket/tests/echo-server.py23
2 files changed, 47 insertions, 0 deletions
diff --git a/contrib/python/websocket-client/py3/patches/01-fix-tests.patch b/contrib/python/websocket-client/py3/patches/01-fix-tests.patch
new file mode 100644
index 0000000000..db6ba4b667
--- /dev/null
+++ b/contrib/python/websocket-client/py3/patches/01-fix-tests.patch
@@ -0,0 +1,24 @@
+--- contrib/python/websocket-client/py3/websocket/tests/test_http.py (index)
++++ contrib/python/websocket-client/py3/websocket/tests/test_http.py (working tree)
+@@ -74,7 +74,8 @@ class HeaderSockMock(SockMock):
+
+ def __init__(self, fname):
+ SockMock.__init__(self)
+- path = os.path.join(os.path.dirname(__file__), fname)
++ import yatest.common
++ path = yatest.common.source_path(os.path.join('contrib/python/websocket-client/py3/websocket/tests', fname))
+ with open(path, "rb") as f:
+ self.add_packet(f.read())
+
+--- contrib/python/websocket-client/py3/websocket/tests/test_websocket.py (index)
++++ contrib/python/websocket-client/py3/websocket/tests/test_websocket.py (working tree)
+@@ -86,7 +86,8 @@ class HeaderSockMock(SockMock):
+
+ def __init__(self, fname):
+ SockMock.__init__(self)
+- path = os.path.join(os.path.dirname(__file__), fname)
++ import yatest.common
++ path = yatest.common.source_path(os.path.join('contrib/python/websocket-client/py3/websocket/tests', fname))
+ with open(path, "rb") as f:
+ self.add_packet(f.read())
+
diff --git a/contrib/python/websocket-client/py3/websocket/tests/echo-server.py b/contrib/python/websocket-client/py3/websocket/tests/echo-server.py
new file mode 100644
index 0000000000..5d1e87087b
--- /dev/null
+++ b/contrib/python/websocket-client/py3/websocket/tests/echo-server.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+# From https://github.com/aaugustin/websockets/blob/main/example/echo.py
+
+import asyncio
+import os
+
+import websockets
+
+LOCAL_WS_SERVER_PORT = int(os.environ.get("LOCAL_WS_SERVER_PORT", "8765"))
+
+
+async def echo(websocket):
+ async for message in websocket:
+ await websocket.send(message)
+
+
+async def main():
+ async with websockets.serve(echo, "localhost", LOCAL_WS_SERVER_PORT):
+ await asyncio.Future() # run forever
+
+
+asyncio.run(main())