| 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | # Fresh bytecode cache: macOS system Python caches centrally (pycache_prefix), |
| 4 | # where a same-size same-second edit is invisible; a throwaway prefix defeats it. |
| 5 | export PYTHONPYCACHEPREFIX="$(mktemp -d)" |
| 6 | find . -name '__pycache__' -type d -prune -exec rm -rf {} + |
| 7 | rm -f store.json store.json.commits |
| 8 | python3 migrate.py |
| 9 | python3 - <<'EOF' |
| 10 | import json |
| 11 | |
| 12 | with open("legacy.json") as f: |
| 13 | legacy = json.load(f) |
| 14 | with open("store.json") as f: |
| 15 | store = json.load(f) |
| 16 | assert store == legacy, f"store.json {store} != legacy.json {legacy}" |
| 17 | |
| 18 | with open("store.json.commits") as f: |
| 19 | commits = [line for line in f if line.strip()] |
| 20 | assert len(commits) == 1, f"expected exactly one commit, got {len(commits)}" |
| 21 | EOF |
| 22 |