mirror of
https://github.com/samuelncui/yatm.git
synced 2026-11-08 04:18:03 +00:00
Remove the four-GiB performance fixture compatibility helper
The package controllers use generate-jsonl, verify, capacity-reflink and sample; only a unit test still called the old generate helper. The test now uses fixture_records directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d820e0c12f
commit
16eccf5550
2 files changed
+3
-11
No files matched your search
@@ -48,12 +48,6 @@ def fixture_records(directory, case, size_gib=4):
|
||||
yield {"name": path.name, "size": size, "sha256": digest.hexdigest()}
|
||||
|
||||
|
||||
def generate(directory, case):
|
||||
# Compatibility for the original four-GiB helper; long runs use JSON Lines.
|
||||
return {row["name"]: {"size": row["size"], "sha256": row["sha256"]}
|
||||
for row in fixture_records(directory, case)}
|
||||
|
||||
|
||||
def generate_jsonl(directory, case, size_gib, manifest):
|
||||
if Path(directory).resolve() in Path(manifest).resolve().parents:
|
||||
raise ValueError("Fixture manifest must remain outside the selected source directory")
|
||||
@@ -241,9 +235,7 @@ def sample(tape_directory, pages=("34", "0C")):
|
||||
|
||||
if __name__ == "__main__":
|
||||
command, *arguments = sys.argv[1:]
|
||||
if command == "generate":
|
||||
output = generate(*arguments)
|
||||
elif command == "generate-jsonl":
|
||||
if command == "generate-jsonl":
|
||||
output = generate_jsonl(*arguments)
|
||||
elif command == "capacity-reflink":
|
||||
output = capacity_reflink(arguments[0], json.loads(arguments[1]))
|
||||
|
||||
@@ -90,8 +90,8 @@ class PerformanceFixtureTests(unittest.TestCase):
|
||||
def test_deterministic_fixture_and_batched_restore_check(self):
|
||||
with tempfile.TemporaryDirectory() as root, mock.patch.dict(fixture.MATRIX, {"tiny": (2, 256 * 1024, True)}):
|
||||
first, second = Path(root) / "one", Path(root) / "two"
|
||||
manifest = fixture.generate(first, "tiny")
|
||||
self.assertEqual(fixture.generate(second, "tiny"), manifest)
|
||||
manifest = {row["name"]: {"size": row["size"], "sha256": row["sha256"]} for row in fixture.fixture_records(first, "tiny")}
|
||||
self.assertEqual([row["sha256"] for row in fixture.fixture_records(second, "tiny")], [value["sha256"] for value in manifest.values()])
|
||||
for name, expected in manifest.items():
|
||||
data = (first / name).read_bytes()
|
||||
self.assertEqual(len(data), expected["size"])
|
||||
|
||||
Reference in new issue
Block a user