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

@ -1,6 +1,9 @@
#![cfg(all(feature = "python", feature = "pypi"))] #![cfg(all(feature = "python", feature = "pypi"))]
/// Generated by `./scripts/scenarios/update.py` /// DO NOT EDIT
///
/// GENERATED WITH `./scripts/scenarios/update.py`
/// SCENARIOS FROM `https://github.com/zanieb/packse/tree/682bf4ff269f130f92bf35fdb58b6b27c94b579a/scenarios`
use std::process::Command; use std::process::Command;
use anyhow::Result; use anyhow::Result;

View File

@ -1,7 +1,11 @@
#![cfg(all(feature = "python", feature = "pypi"))] #![cfg(all(feature = "python", feature = "pypi"))]
/// {{generated_by}} /// DO NOT EDIT
///
/// GENERATED WITH `{{generated_with}}`
/// SCENARIOS FROM `{{generated_from}}`
use std::process::Command; use std::process::Command;

View File

@ -4,7 +4,7 @@
# #
# Usage: # Usage:
# #
# $ scripts/scenarios/update.py # $ ./scripts/scenarios/update.py
# #
# Requirements: # Requirements:
# #
@ -84,10 +84,12 @@ if packse.__development_base_path__.name != "packse":
) )
scenarios_path = str(PACKSE / "scenarios") scenarios_path = str(PACKSE / "scenarios")
else: 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") scenarios_path = str(packse.__development_base_path__ / "scenarios")
print("Loading scenario metadata...", file=sys.stderr) print("Loading scenario metadata...", file=sys.stderr)
data = json.loads( data = json.loads(
subprocess.check_output( subprocess.check_output(
@ -99,8 +101,17 @@ data = json.loads(
) )
) )
# Add a generated note # Add generated metadata
data["generated_by"] = f"Generated by `{' '.join(sys.argv)}`" 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 # Add normalized names for tests
for scenario in data["scenarios"]: for scenario in data["scenarios"]: