5 TAL test pass
This commit is contained in:
parent
13516c4f73
commit
0f3d65254e
@ -151,7 +151,15 @@ delta_meta_path = Path(sys.argv[8])
|
|||||||
out_md_path = Path(sys.argv[9])
|
out_md_path = Path(sys.argv[9])
|
||||||
|
|
||||||
def load_json(p: Path):
|
def load_json(p: Path):
|
||||||
return json.loads(p.read_text(encoding="utf-8"))
|
s = p.read_text(encoding="utf-8")
|
||||||
|
try:
|
||||||
|
return json.loads(s)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
# Backwards-compat / robustness: tolerate accidental literal trailing "\\n".
|
||||||
|
s2 = s.strip()
|
||||||
|
if s2.endswith("\\n"):
|
||||||
|
s2 = s2[:-2].rstrip()
|
||||||
|
return json.loads(s2)
|
||||||
|
|
||||||
def load_optional_json(path_s: str):
|
def load_optional_json(path_s: str):
|
||||||
if not path_s:
|
if not path_s:
|
||||||
@ -159,7 +167,7 @@ def load_optional_json(path_s: str):
|
|||||||
p = Path(path_s)
|
p = Path(path_s)
|
||||||
if not p.exists():
|
if not p.exists():
|
||||||
return None
|
return None
|
||||||
return json.loads(p.read_text(encoding="utf-8"))
|
return load_json(p)
|
||||||
|
|
||||||
def parse_rrdp_state_tsv(p: Path):
|
def parse_rrdp_state_tsv(p: Path):
|
||||||
# format: "<notify_uri>\t<serial>\t<session_id>"
|
# format: "<notify_uri>\t<serial>\t<session_id>"
|
||||||
@ -272,7 +280,7 @@ delta_meta = {
|
|||||||
"total_script": int(os.environ["TOTAL_DURATION_S"]),
|
"total_script": int(os.environ["TOTAL_DURATION_S"]),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
delta_meta_path.write_text(json.dumps(delta_meta, ensure_ascii=False, indent=2) + "\\n", encoding="utf-8")
|
delta_meta_path.write_text(json.dumps(delta_meta, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||||
|
|
||||||
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
|
||||||
|
|||||||
@ -127,7 +127,7 @@ meta = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_path.write_text(json.dumps(meta, ensure_ascii=False, indent=2) + "\\n", encoding="utf-8")
|
meta_path.write_text(json.dumps(meta, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
lines.append("# Manual full sync summary\\n\\n")
|
lines.append("# Manual full sync summary\\n\\n")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user