diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-23 22:25:28 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-24 16:45:37 +0200 |
| commit | 328b01a2dd545d70a078db8df1e91b02d65bfc9c (patch) | |
| tree | 9af69d617d9482ba4256f3d7334c9dd6cde0d5e2 /packages/meshbay-hub/tests/test_video_buffer_ceiling.py | |
| parent | 92ea222b7aca6a3eb5f04330f0af6755e6e434e3 (diff) | |
| download | meshbay-328b01a2dd545d70a078db8df1e91b02d65bfc9c.tar.gz | |
test: read the WebRTC transport's source as a set of files
Source-reading tests take their text from node_source (node) and node_tree
(hub): webrtc_server.py plus anything under transport/webrtc/, so a check
for something's absence keeps reading the code it guards if that code moves.
test_node_source_scope holds the boundary.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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") |