mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Use more realistic names in scenario snapshots (#978)
This is helpful to make the error messages more realistic and the names are indisputably cuter.
This commit is contained in:
parent
5adb08a304
commit
5fe3444e5a
3 changed files with 307 additions and 219 deletions
File diff suppressed because it is too large
Load diff
|
@ -67,8 +67,11 @@ fn {{module_name}}() -> Result<()> {
|
|||
let cache_dir = assert_fs::TempDir::new()?;
|
||||
let venv = create_venv(&temp_dir, &cache_dir, "python{{environment.python}}");
|
||||
|
||||
// In addition to the standard filters, remove the scenario version
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
{{#packages}}
|
||||
filters.push((r"{{name}}", "{{cute_name}}"));
|
||||
{{/packages}}
|
||||
filters.push((r"-{{version}}", ""));
|
||||
|
||||
insta::with_settings!({
|
||||
|
|
|
@ -52,6 +52,16 @@ PACKSE = TOOL_ROOT / "packse-scenarios"
|
|||
REQUIREMENTS = TOOL_ROOT / "requirements.txt"
|
||||
PROJECT_ROOT = TOOL_ROOT.parent.parent
|
||||
TARGET = PROJECT_ROOT / "crates" / "puffin" / "tests" / "pip_install_scenarios.rs"
|
||||
CUTE_NAMES = {
|
||||
"a": "albatross",
|
||||
"b": "bluebird",
|
||||
"c": "crow",
|
||||
"d": "duck",
|
||||
"e": "eagle",
|
||||
"f": "flamingo",
|
||||
"g": "goose",
|
||||
"h": "heron",
|
||||
}
|
||||
|
||||
try:
|
||||
import packse
|
||||
|
@ -165,6 +175,11 @@ for scenario in data["scenarios"]:
|
|||
else []
|
||||
)
|
||||
|
||||
# Generate cute names for each scenario
|
||||
for scenario in data["scenarios"]:
|
||||
for package in scenario["packages"]:
|
||||
package["cute_name"] = CUTE_NAMES[package["name"][0]]
|
||||
|
||||
|
||||
# Render the template
|
||||
print("Rendering template...", file=sys.stderr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue