Include permalink to scenarios used to generate test cases (#767)

This commit is contained in:
Zanie Blue 2024-01-03 20:41:14 -06:00 committed by GitHub
parent 0bdd831a0d
commit e18a6a0c03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 7 deletions

View file

@ -4,7 +4,7 @@
#
# Usage:
#
# $ scripts/scenarios/update.py
# $ ./scripts/scenarios/update.py
#
# Requirements:
#
@ -84,10 +84,12 @@ if packse.__development_base_path__.name != "packse":
)
scenarios_path = str(PACKSE / "scenarios")
else:
print("Using local packse scenarios...", file=sys.stderr)
print(
f"Using scenarios in packse repository at {packse.__development_base_path__}",
file=sys.stderr,
)
scenarios_path = str(packse.__development_base_path__ / "scenarios")
print("Loading scenario metadata...", file=sys.stderr)
data = json.loads(
subprocess.check_output(
@ -99,8 +101,17 @@ data = json.loads(
)
)
# Add a generated note
data["generated_by"] = f"Generated by `{' '.join(sys.argv)}`"
# Add generated metadata
commit = (
subprocess.check_output(
["git", "show", "-s", "--format=%H", "HEAD"], cwd=scenarios_path
)
.decode()
.strip()
)
data["generated_from"] = f"https://github.com/zanieb/packse/tree/{commit}/scenarios"
data["generated_with"] = " ".join(sys.argv)
# Add normalized names for tests
for scenario in data["scenarios"]: