From 320620a18399eb43c4d9056e9fe4c3ffac8fcfd4 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Fri, 25 Sep 2026 01:17:32 +0200 Subject: test(node): read ops wherever it is split The tests that read ops.py for an absence (fastapi, a TOML path without as_posix, the reference app's name) and the one counting operations by module now take every file of ops.py or the ops package. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/tests/node_tree.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'packages/meshbay-hub/tests/node_tree.py') diff --git a/packages/meshbay-hub/tests/node_tree.py b/packages/meshbay-hub/tests/node_tree.py index 8704492..356bc81 100644 --- a/packages/meshbay-hub/tests/node_tree.py +++ b/packages/meshbay-hub/tests/node_tree.py @@ -52,3 +52,19 @@ def method(name: str) -> str: found.append(ast.get_source_segment(text, member, padded=True)) assert len(found) == 1, f"{name}: expected one definition, found {len(found)}" return found[0] + + +def module_files(name: str) -> list[Path]: + """A node module by name — `ops.py`, or every file of the `ops/` package it + becomes — so a test reading it for an absence goes on reading all of it.""" + src = TRANSPORT.parent + files = [src / f"{name}.py"] if (src / f"{name}.py").exists() else [] + if (src / name).is_dir(): + files += sorted(p for p in (src / name).rglob("*.py") + if "__pycache__" not in p.parts) + assert files, f"no module or package named {name} in the node" + return files + + +def module_source(name: str) -> str: + return "\n".join(p.read_text(encoding="utf-8") for p in module_files(name)) -- cgit v1.2.3