diff options
Diffstat (limited to 'packages/meshbay-hub/tests/test_video_buffer_ceiling.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_video_buffer_ceiling.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/packages/meshbay-hub/tests/test_video_buffer_ceiling.py b/packages/meshbay-hub/tests/test_video_buffer_ceiling.py index 7dd9c81..a488976 100644 --- a/packages/meshbay-hub/tests/test_video_buffer_ceiling.py +++ b/packages/meshbay-hub/tests/test_video_buffer_ceiling.py @@ -54,12 +54,11 @@ import shutil import subprocess from pathlib import Path +import node_tree import pytest STATIC = Path(__file__).resolve().parents[1] / "src" / "meshbay_hub" / "static" APP = STATIC / "video-player.js" -NODE_SERVER = (Path(__file__).resolve().parents[2] / "meshbay-node" / "src" - / "meshbay_node" / "transport" / "webrtc_server.py") pytestmark = pytest.mark.skipif( shutil.which("node") is None or not APP.exists(), @@ -390,20 +389,17 @@ def test_a_buffered_viewer_still_tells_the_node_it_is_there(app): "the node's stall timeout ends a film that is merely paused") -@pytest.mark.skipif(not NODE_SERVER.exists(), reason="node sources unavailable") +@pytest.mark.skipif(not node_tree.available(), reason="node sources unavailable") def test_the_node_ends_a_stream_on_silence_not_on_stinginess(): """The other half of the keepalive: the node has to honour it.""" - text = NODE_SERVER.read_text() - i = text.index("async def _await_stream_credit") - body = text[i:text.index("\n async def ", i + 1)] + body = node_tree.method("_await_stream_credit") assert "self._stream_heard_at" in body, ( "the stall budget still accumulates over the whole wait, so a keepalive " "that grants no credit cannot keep a paused film alive") assert "waited += STREAM_CREDIT_POLL" not in body, ( "the budget still accumulates over the whole wait rather than being " "measured from the last thing the peer said") - grant = text[text.index("def _grant_stream_credit"):] - grant = grant[:grant.index("\n def ", 1)] + grant = node_tree.method("_grant_stream_credit") assert "self._stream_heard_at = time.monotonic()" in grant, ( "n=0 does not refresh the timeout, so the keepalive is a no-op") |