From 1fe148305bbc28f449125adb430d328ba34db455 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Fri, 4 Sep 2026 12:59:48 -0700 Subject: [PATCH] [eric] tests: the Tisusa-shaped image is incompressible like a real one, and the importer's regenerated .env is counted as its own Co-Authored-By: Claude Fable 5.1 --- backend/tests/test_swarm_tisusa_shape.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/tests/test_swarm_tisusa_shape.py b/backend/tests/test_swarm_tisusa_shape.py index b014fb0a..3420993f 100644 --- a/backend/tests/test_swarm_tisusa_shape.py +++ b/backend/tests/test_swarm_tisusa_shape.py @@ -37,7 +37,7 @@ def build_tisusa_shaped_tree(root: str) -> list[str]: full = os.path.join(root, *rel.split("/")) os.makedirs(os.path.dirname(full), exist_ok=True) with open(full, "wb") as f: - f.write(b"\x89PNG" + b"\0" * (1_262_398 - 4) if rel == BIG_FILE else f"// {rel}\n".encode()) + f.write(b"\x89PNG" + os.urandom(1_262_398 - 4) if rel == BIG_FILE else f"// {rel}\n".encode()) return rels @@ -66,8 +66,12 @@ def test_a_tisusa_shaped_bundle_round_trips_with_every_file_on_this_os(): assert imported is not None and imported.workspace_id, "the app imported without a workspace (the hollow-app shape)" dest = os.path.join(appmod.OUTPUTS_WORKSPACE_DIR, imported.workspace_id) on_disk = sorted(os.path.relpath(os.path.join(r, f), dest).replace(os.sep, "/") for r, _, fs in os.walk(dest) for f in fs) - assert len(on_disk) == 507, f"{len(on_disk)} files landed, expected 507" + # 507 from the bundle plus the .env the importer regenerates from .env.example for this machine (the + # real Tisusa import lands 508 the same way). + assert ".env" in on_disk, "the importer did not localize an .env from .env.example" + landed = [r for r in on_disk if r != ".env"] + assert len(landed) == 507, f"{len(landed)} files landed, expected 507" for rel in DOTFILES + SPACED + [LONG_PATH, BIG_FILE]: - assert rel in on_disk, f"{rel} did not land" + assert rel in landed, f"{rel} did not land" assert os.path.getsize(os.path.join(dest, *BIG_FILE.split("/"))) == 1_262_398 - assert sorted(rels) == on_disk + assert sorted(rels) == landed