aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-19 14:39:38 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-19 14:39:38 +0200
commit9e7b75bb0f6f6649fb00f2dc97059e90b7d52875 (patch)
tree94463bba19b424fdce6db0d4dacbc1901af8ea95 /packages/meshbay-hub/tests
parent86188385cbdae1ee90c1dca7a7b9db2edef1ecd4 (diff)
downloadmeshbay-9e7b75bb0f6f6649fb00f2dc97059e90b7d52875.tar.gz
style: the 98 ruff could not fix, so the linter is a signal again
The pass before this applied ruff's own fixes. These are the ones needing a decision, and the point of doing them is that `ruff check .` now passes: a linter reporting 98 known-acceptable findings reports nothing, because the next real one arrives invisible. **Lines over 100 (70).** Mostly wrapped where they stood. Two exceptions: the aligned trailing comments in `protocol.py`'s message table were shortened rather than wrapped, because wrapping one row of a table breaks the table; and in `models.py` the column comments moved above their columns for the same reason. **Imports below the first statement (14).** `csam.py` kept its FastAPI imports under a section header halfway down the file; two node tests had a constant and a `pytestmark` wedged between two import blocks. Moved, not suppressed. **Bindings nothing reads (4).** Three in tests, where the call stays and only the name goes — `_user(client, "listener")` is there to create the user, not to return one. The fourth was in `revocation.py` and was not a lint finding at all: `_connect_and_listen` opened an httpx stream to the WebSocket URL, did `pass`, and then opened the real connection through the `websockets` library. One pointless request per connect, left over from before that library was used directly. Removed, and `httpx` with it. **`l` as a name (4)**, **semicolons (6)** in the POC spikes, and the rest. 2893 passed, the same count as the two commits before it. `meshbay_node/revocation.py` is worth a decision separately: 154 lines that nothing imports, superseded by `hub_client.maintain_ws`'s `on_revocation`. This commit only stopped it failing the linter. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests')
-rw-r--r--packages/meshbay-hub/tests/harness/boot_guard_probe.py3
-rwxr-xr-xpackages/meshbay-hub/tests/harness/menu_scroll_probe.py3
-rw-r--r--packages/meshbay-hub/tests/harness/music_grid_probe.py6
-rwxr-xr-xpackages/meshbay-hub/tests/harness/music_queue_probe.py3
-rwxr-xr-xpackages/meshbay-hub/tests/harness/playlist_store_probe.py6
-rw-r--r--packages/meshbay-hub/tests/harness/playlist_ui_probe.py12
-rw-r--r--packages/meshbay-hub/tests/test_files_drop_upload.py3
-rw-r--r--packages/meshbay-hub/tests/test_hook_ordering.py3
-rw-r--r--packages/meshbay-hub/tests/test_hub_api.py16
-rw-r--r--packages/meshbay-hub/tests/test_layout_measured.py6
-rw-r--r--packages/meshbay-hub/tests/test_locales.py9
-rw-r--r--packages/meshbay-hub/tests/test_memory_ceiling.py6
-rw-r--r--packages/meshbay-hub/tests/test_notifications_behaviour.py2
-rw-r--r--packages/meshbay-hub/tests/test_transfers.py5
14 files changed, 56 insertions, 27 deletions
diff --git a/packages/meshbay-hub/tests/harness/boot_guard_probe.py b/packages/meshbay-hub/tests/harness/boot_guard_probe.py
index 01751ba..b4a5e7c 100644
--- a/packages/meshbay-hub/tests/harness/boot_guard_probe.py
+++ b/packages/meshbay-hub/tests/harness/boot_guard_probe.py
@@ -83,7 +83,8 @@ const cases = [];
const post = (o) => fetch('/log', { method: 'POST', body: JSON.stringify(o) });
addEventListener('error', (e) => post({ error: 'page error: ' + (e.message || e) }));
addEventListener('unhandledrejection',
- (e) => post({ error: 'rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason) }));
+ (e) => post({ error: 'rejection: '
+ + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason) }));
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const add = (src) => {
const f = document.createElement('iframe');
diff --git a/packages/meshbay-hub/tests/harness/menu_scroll_probe.py b/packages/meshbay-hub/tests/harness/menu_scroll_probe.py
index 5fb9579..c4d3b87 100755
--- a/packages/meshbay-hub/tests/harness/menu_scroll_probe.py
+++ b/packages/meshbay-hub/tests/harness/menu_scroll_probe.py
@@ -48,7 +48,8 @@ import { Menu } from '/menu.js';
const LOGS = [];
addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e)));
addEventListener('unhandledrejection',
- (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
+ (e) => LOGS.push('rejection: '
+ + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const frame = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));
diff --git a/packages/meshbay-hub/tests/harness/music_grid_probe.py b/packages/meshbay-hub/tests/harness/music_grid_probe.py
index 365e028..0cf65bc 100644
--- a/packages/meshbay-hub/tests/harness/music_grid_probe.py
+++ b/packages/meshbay-hub/tests/harness/music_grid_probe.py
@@ -100,7 +100,8 @@ import { MusicPlayerBar } from '/music-player.js';
const LOGS = [];
addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e)));
addEventListener('unhandledrejection',
- (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
+ (e) => LOGS.push('rejection: '
+ + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const waitFor = async (sel, tries = 60) => {
@@ -209,7 +210,8 @@ const clickMenu = async (i) => {
const last = rows[rows.length - 1];
const entry = { artist: label, top,
heading: heading ? heading.textContent : null,
- headingH: heading ? Math.round(heading.getBoundingClientRect().height) : null };
+ headingH: heading
+ ? Math.round(heading.getBoundingClientRect().height) : null };
if (last && Math.abs(last.top - top) < 8) last.cells.push(entry);
else rows.push({ top, cells: [entry] });
}
diff --git a/packages/meshbay-hub/tests/harness/music_queue_probe.py b/packages/meshbay-hub/tests/harness/music_queue_probe.py
index a9146ce..9138db9 100755
--- a/packages/meshbay-hub/tests/harness/music_queue_probe.py
+++ b/packages/meshbay-hub/tests/harness/music_queue_probe.py
@@ -99,7 +99,8 @@ import { MusicPlayerBar } from '/music-player.js';
const LOGS = [];
addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e)));
addEventListener('unhandledrejection',
- (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
+ (e) => LOGS.push('rejection: '
+ + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const waitFor = async (sel, tries = 60) => {
diff --git a/packages/meshbay-hub/tests/harness/playlist_store_probe.py b/packages/meshbay-hub/tests/harness/playlist_store_probe.py
index 6421426..9a54a0d 100755
--- a/packages/meshbay-hub/tests/harness/playlist_store_probe.py
+++ b/packages/meshbay-hub/tests/harness/playlist_store_probe.py
@@ -38,7 +38,8 @@ import { MANIFEST_KIND, bodyKind } from '/playlist-merge.js';
const LOGS = [];
addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e)));
addEventListener('unhandledrejection',
- (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
+ (e) => LOGS.push('rejection: '
+ + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
const USER = 'user-1';
const steps = [];
@@ -95,7 +96,8 @@ function fakeNode() {
await P.addTracks(USER, P.FAVORITES_ID, [track(9)], 'g1', 'Favoris');
steps.push({ step: 'after editing',
- list: (await P.listPlaylists(USER)).map((p) => ({ id: p.id, name: p.name, count: p.count })) });
+ list: (await P.listPlaylists(USER))
+ .map((p) => ({ id: p.id, name: p.name, count: p.count })) });
steps.push({ step: 'tracks read back',
tracks: (await P.getPlaylistTracks(USER, eveningId)).map((t) => ({
diff --git a/packages/meshbay-hub/tests/harness/playlist_ui_probe.py b/packages/meshbay-hub/tests/harness/playlist_ui_probe.py
index f0fc9c3..b60baf6 100644
--- a/packages/meshbay-hub/tests/harness/playlist_ui_probe.py
+++ b/packages/meshbay-hub/tests/harness/playlist_ui_probe.py
@@ -98,7 +98,8 @@ import * as P from '/playlists.js';
const LOGS = [];
addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e)));
addEventListener('unhandledrejection',
- (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
+ (e) => LOGS.push('rejection: '
+ + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason)));
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const waitFor = async (sel, tries = 60) => {
@@ -253,7 +254,8 @@ const clickMenu = async (i) => {
open.click();
await waitFor('.music-detail .music-tracklist');
steps.push({ step: 'loaded into the queue',
- play: [...document.querySelectorAll('.music-detail .music-tracklist .music-track-title')]
+ play: [...document.querySelectorAll(
+ '.music-detail .music-tracklist .music-track-title')]
.map((e) => e.textContent) });
document.querySelector('.music-detail .video-close').click();
await sleep(150);
@@ -267,8 +269,10 @@ const clickMenu = async (i) => {
await clickLabel('A2-t2');
await sleep(300);
steps.push({ step: 'track removed',
- lists: (await P.listPlaylists('u1')).map((p) => ({ name: p.name, count: p.count })),
- tracks: (await P.getPlaylistTracks('u1', lists.find((p) => p.name === 'Soirée').id))
+ lists: (await P.listPlaylists('u1'))
+ .map((p) => ({ name: p.name, count: p.count })),
+ tracks: (await P.getPlaylistTracks('u1',
+ lists.find((p) => p.name === 'Soirée').id))
.map((tr) => tr.display_title) });
// 6. Delete it.
diff --git a/packages/meshbay-hub/tests/test_files_drop_upload.py b/packages/meshbay-hub/tests/test_files_drop_upload.py
index 5dfaf23..fc15c47 100644
--- a/packages/meshbay-hub/tests/test_files_drop_upload.py
+++ b/packages/meshbay-hub/tests/test_files_drop_upload.py
@@ -66,7 +66,8 @@ def test_names_in_a_folder_count_files_folders_and_empty_folders(tmp_path, sourc
{"path": "music/Album", "name": "t.flac"},
{"path": "musicals", "name": "not-here.txt"}]
got = _run(tmp_path, source,
- f"namesIn({json.dumps(entries)}, ['music/Empty', 'music/Album/cd1'], 'music').sort()")
+ f"namesIn({json.dumps(entries)}, "
+ f"['music/Empty', 'music/Album/cd1'], 'music').sort()")
assert got == ["Album", "Empty", "a.mp3"]
diff --git a/packages/meshbay-hub/tests/test_hook_ordering.py b/packages/meshbay-hub/tests/test_hook_ordering.py
index 3c82bb0..d03cdf5 100644
--- a/packages/meshbay-hub/tests/test_hook_ordering.py
+++ b/packages/meshbay-hub/tests/test_hook_ordering.py
@@ -123,7 +123,8 @@ def test_the_check_would_notice():
# Inject a dependency on `last` into the first declaration's dep array.
end = broken.index("\n }, [", decls[0].start())
close = broken.index("]", end)
- broken = broken[:close] + (", " if broken[end + 7:close].strip() else "") + last + broken[close:]
+ broken = (broken[:close] + (", " if broken[end + 7:close].strip() else "")
+ + last + broken[close:])
declared_at = {m.group(1): m.start() for m in DECL.finditer(broken)}
caught = False
diff --git a/packages/meshbay-hub/tests/test_hub_api.py b/packages/meshbay-hub/tests/test_hub_api.py
index 9b73701..2afd27b 100644
--- a/packages/meshbay-hub/tests/test_hub_api.py
+++ b/packages/meshbay-hub/tests/test_hub_api.py
@@ -260,7 +260,9 @@ async def test_group_member_add(client):
"pk_user_ed25519": pk_ed, "pk_user_x25519": pk_x})
alice_token = (await client.post("/v1/users/login",
- json={"username": "alice2_test", "password": "alicepass99"})).json()["access_token"]
+ json={"username": "alice2_test",
+ "password": "alicepass99"})
+ ).json()["access_token"]
a_hdrs = {"Authorization": f"Bearer {alice_token}"}
@@ -298,9 +300,13 @@ async def test_non_admin_cannot_add_member(client):
"pk_user_ed25519": pk_ed, "pk_user_x25519": pk_x})
charlie_token = (await client.post("/v1/users/login",
- json={"username": "charlie_test", "password": "charliepass"})).json()["access_token"]
+ json={"username": "charlie_test",
+ "password": "charliepass"})
+ ).json()["access_token"]
dan_token = (await client.post("/v1/users/login",
- json={"username": "dan_test", "password": "danpass1234"})).json()["access_token"]
+ json={"username": "dan_test",
+ "password": "danpass1234"})
+ ).json()["access_token"]
r = await client.post("/v1/groups", json={"name": "charlies-group"},
headers={"Authorization": f"Bearer {charlie_token}"})
@@ -338,7 +344,9 @@ async def test_jwt_contains_groups_claim(client):
# Alice creates a group and adds Bob
alice_token = (await client.post("/v1/users/login",
- json={"username": "grp_alice", "password": "alicepass99"})).json()["access_token"]
+ json={"username": "grp_alice",
+ "password": "alicepass99"})
+ ).json()["access_token"]
r = await client.post("/v1/groups", json={"name": "testgroup"},
headers={"Authorization": f"Bearer {alice_token}"})
group_id = r.json()["group_id"]
diff --git a/packages/meshbay-hub/tests/test_layout_measured.py b/packages/meshbay-hub/tests/test_layout_measured.py
index a71b6b9..9bf1bde 100644
--- a/packages/meshbay-hub/tests/test_layout_measured.py
+++ b/packages/meshbay-hub/tests/test_layout_measured.py
@@ -178,7 +178,8 @@ GROUPED = textwrap.dedent("""
<button class="transfer-cancel">&#10005;</button>
</div>
<div class="dl-progress"><div class="dl-fill" style="width:42%"></div></div>
- <div class="transfer-meta"><span>210 MB / 493 MB</span><span>3.1 MB/s &middot; 4 min left</span></div>
+ <div class="transfer-meta"><span>210 MB / 493 MB</span>
+ <span>3.1 MB/s &middot; 4 min left</span></div>
</div>
</div>
<div class="transfer-group">
@@ -190,7 +191,8 @@ GROUPED = textwrap.dedent("""
<button class="transfer-cancel">&#10005;</button>
</div>
<div class="dl-progress dl-waiting"></div>
- <div class="transfer-meta"><span>Waiting &mdash; your slots are busy</span><span>1.2 GB</span></div>
+ <div class="transfer-meta"><span>Waiting &mdash; your slots are busy</span>
+ <span>1.2 GB</span></div>
</div>
</div>
</div>
diff --git a/packages/meshbay-hub/tests/test_locales.py b/packages/meshbay-hub/tests/test_locales.py
index 59ea2bf..602d161 100644
--- a/packages/meshbay-hub/tests/test_locales.py
+++ b/packages/meshbay-hub/tests/test_locales.py
@@ -158,7 +158,8 @@ def test_locale_resolution_is_region_aware(tmp_path):
const out = {};
for (const tags of [['pt-BR'], ['pt'], ['zh-CN'], ['zh'], ['fr-CA'],
['de-AT'], ['ru', 'it'], ['ko']]) {
- Object.defineProperty(globalThis, 'navigator', { value: { languages: tags, language: tags[0] }, configurable: true });
+ Object.defineProperty(globalThis, 'navigator',
+ { value: { languages: tags, language: tags[0] }, configurable: true });
delete store.mb_lang;
out[tags.join(',')] = await i18n.initLocale();
}
@@ -186,7 +187,8 @@ def test_counted_string_picks_the_right_polish_form(tmp_path):
setItem: (k, v) => { store[k] = v; },
};
globalThis.document = { documentElement: {} };
- Object.defineProperty(globalThis, 'navigator', { value: { languages: ['pl'], language: 'pl' }, configurable: true });
+ Object.defineProperty(globalThis, 'navigator',
+ { value: { languages: ['pl'], language: 'pl' }, configurable: true });
const i18n = await import('./i18n.js');
await i18n.initLocale();
console.log(JSON.stringify(
@@ -205,7 +207,8 @@ def test_interpolated_value_is_not_read_as_a_replacement_pattern(tmp_path):
setItem: (k, v) => { store[k] = v; },
};
globalThis.document = { documentElement: {} };
- Object.defineProperty(globalThis, 'navigator', { value: { languages: ['en'], language: 'en' }, configurable: true });
+ Object.defineProperty(globalThis, 'navigator',
+ { value: { languages: ['en'], language: 'en' }, configurable: true });
const i18n = await import('./i18n.js');
await i18n.initLocale();
console.log(JSON.stringify(
diff --git a/packages/meshbay-hub/tests/test_memory_ceiling.py b/packages/meshbay-hub/tests/test_memory_ceiling.py
index 1654825..5984292 100644
--- a/packages/meshbay-hub/tests/test_memory_ceiling.py
+++ b/packages/meshbay-hub/tests/test_memory_ceiling.py
@@ -246,11 +246,11 @@ def test_no_unguarded_memory_floor(target_fn):
# definition out before looking. Comments go too — the branch that used to
# be the bug is now described in one, and a test that reads prose is the
# mistake already recorded in CLAUDE.md for the packaged systemd unit.
- start = next(n for n, l in enumerate(lines) if "const _memoryFloor" in l)
+ start = next(n for n, ln in enumerate(lines) if "const _memoryFloor" in ln)
end = next(n for n in range(start, len(lines)) if lines[n].strip() == "};")
rest = lines[:start] + lines[end + 1:]
- code = [re.sub(r"//.*$", "", l) for l in rest]
- bare = [l.strip() for l in code if re.search(r"\breturn null\b", l)]
+ code = [re.sub(r"//.*$", "", ln) for ln in rest]
+ bare = [ln.strip() for ln in code if re.search(r"\breturn null\b", ln)]
assert bare == [], (
"an unguarded in-memory fallback was added to _openDownloadTarget; "
"return _memoryFloor() instead: " + "; ".join(bare))
diff --git a/packages/meshbay-hub/tests/test_notifications_behaviour.py b/packages/meshbay-hub/tests/test_notifications_behaviour.py
index 67fd99e..4684d3f 100644
--- a/packages/meshbay-hub/tests/test_notifications_behaviour.py
+++ b/packages/meshbay-hub/tests/test_notifications_behaviour.py
@@ -35,7 +35,7 @@ async def test_chat_keeps_one_notification_per_group(client, db_session):
"""Forty messages are one line saying when the conversation last spoke."""
from meshbay_hub.api.notifications import create_notification
- token = await _user(client, "listener")
+ await _user(client, "listener")
owner = await _user(client, "talker_test")
g = await client.post("/v1/groups", json={"name": "busy"},
headers={"Authorization": f"Bearer {owner}"})
diff --git a/packages/meshbay-hub/tests/test_transfers.py b/packages/meshbay-hub/tests/test_transfers.py
index a776b50..9b65ca5 100644
--- a/packages/meshbay-hub/tests/test_transfers.py
+++ b/packages/meshbay-hub/tests/test_transfers.py
@@ -243,7 +243,10 @@ class L {
acquire() { return this._wait; }
release(reason) { if (!this.closed) { this.closed = true; this.released.push(reason); } }
grant() { this.state = 'granted'; if (this._onState) this._onState(this); this._go(); }
- push(state, ahead) { this.state = state; this.ahead = ahead; if (this._onState) this._onState(this); }
+ push(state, ahead) {
+ this.state = state; this.ahead = ahead;
+ if (this._onState) this._onState(this);
+ }
}
"""