Skip to content

Commit 1ca963c

Browse files
mnriemCopilot
andcommitted
test(workflows): make catalog ZIP fixture deterministic
Pin the workflow ZIP member timestamp so independently generated catalog and download fixtures remain byte-identical across DOS timestamp boundaries. Add a regression using controlled wall-clock values two seconds apart; it fails with the original helper and passes with the fixed timestamp. Production integrity checks and existing negative tests are unchanged. Validation: targeted workflow catalog and Junie tests: 78 passed; Ruff: passed. Full pytest collection: 9014 before, 9015 after. Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent dda9257 commit 1ca963c

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎tests/specify_cli/workflows/test_catalog_versions.py‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import hashlib
66
import io
7+
import time
78
import zipfile
89

910
import pytest
@@ -49,10 +50,24 @@ def _archive(version: str, workflow_id: str = "history-wf", requires=None) -> by
4950
document["requires"] = requires
5051
output = io.BytesIO()
5152
with zipfile.ZipFile(output, "w") as archive:
52-
archive.writestr("workflow.yml", yaml.safe_dump(document))
53+
archive.writestr(
54+
zipfile.ZipInfo("workflow.yml", date_time=(2020, 1, 1, 0, 0, 0)),
55+
yaml.safe_dump(document),
56+
)
5357
return output.getvalue()
5458

5559

60+
def test_archive_is_independent_of_wall_clock(monkeypatch):
61+
archives = []
62+
for second in (2, 4):
63+
wall_clock = time.struct_time((2026, 9, 30, 14, 39, second, 2, 273, -1))
64+
monkeypatch.setattr(
65+
zipfile.time, "localtime", lambda timestamp=None, value=wall_clock: value
66+
)
67+
archives.append(_archive("1.0.0", requires={"integrations": ["copilot"]}))
68+
assert archives[0] == archives[1]
69+
70+
5671
def _entry() -> dict:
5772
old = _archive("1.0.0", requires={"integrations": ["copilot"]})
5873
current = _archive("2.0.0")

0 commit comments

Comments
 (0)