data: data/msgpack (full spec, timestamps as Types.Date, ext values, ordered maps, exact 64-bit text option, streams); Python msgpack fixtures, byte-exact re-encode

This commit is contained in:
4DBug committed 2026-10-31 08:46:58 -05:00
1 parent eeb62192b5
commit 4f44e5ebe3
7 files changed
+775

No files matched your search

+11
View File
@@ -97,3 +97,14 @@ def date_text(v):
if isinstance(v, datetime.date):
return "%04d-%02d-%02d" % (v.year, v.month, v.day)
return "%02d:%02d:%02d%s" % (v.hour, v.minute, v.second, frac(v.microsecond))
def python(ctx, packages, body):
"""run body (with these helpers prepended, so canon() / date_text() exist) under a nix python with packages;
returns stdout bytes, raising with the script's stderr on failure"""
import subprocess as sp
src = open(os.path.abspath(__file__)).read()
try:
return ctx.python(packages, src + "\n" + body)
except sp.CalledProcessError as e:
raise RuntimeError("fixture python failed:\n" + e.stderr.decode(errors="replace")[-3000:])