1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
Description: Fix tests with python3.11
Update test case for python3.11 (changes taken from upstream git repo,
commit 2445b674712cb0093d67d15b5fc10d66e93136d8), and run janus from PATH
instead of directly from the source build tree. So that we can use the
system janus binary if no local build has happened.
Author: Guillem Jover <gjover@sipwise.com>
Last-Update: 2025-04-11
---
test/echo.py | 7 ++++---
test/test_aiortc.sh | 5 +++--
2 files changed, 7 insertions(+), 5 deletions(-)
--- a/test/echo.py
+++ b/test/echo.py
@@ -30,7 +30,7 @@ class WebSocketClient():
ping_interval=10,
ping_timeout=10,
compression=None)
- if self.connection.open:
+ if self.connection.state == ws.State.OPEN:
asyncio.ensure_future(self.receiveMessage())
logger.info('WebSocket connected')
return self
@@ -256,7 +256,7 @@ async def run(pc, player, session, bitra
await asyncio.sleep(5)
# Check WebSocket status
- assert session._websocket.connection.open
+ assert session._websocket.connection.state == ws.State.OPEN
# Get RTC stats and check the status
rtcstats = await pc.getStats()
@@ -307,7 +307,8 @@ if __name__ == '__main__':
else:
player = None
- loop = asyncio.get_event_loop()
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
try:
loop.run_until_complete(
run(pc=pc, player=player, session=session)
--- a/test/test_aiortc.sh
+++ b/test/test_aiortc.sh
@@ -2,12 +2,13 @@
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
JANUS_SRC="$( dirname $SCRIPTPATH )"
+PATH="$JANUS_SRC/src:$PATH"
TEST=${1-"$SCRIPTPATH/echo.py"}
URL=${2-"ws://localhost:8188/"}
-echo "Starting Janus binary from $JANUS_SRC ..."
-$JANUS_SRC/janus >/dev/null 2>&1 &
+echo "Starting Janus binary ..."
+janus >/dev/null 2>&1 &
JANUS_PID=$!
echo "Waiting for some seconds before launching the test ..."
|