From acd427c103cc6b27ece9676dcb741663cc253756 Mon Sep 17 00:00:00 2001 From: Aria Desires Date: Thu, 1 May 2025 08:11:38 -0400 Subject: [PATCH] make snapshot test more permissive --- crates/uv/tests/it/version.rs | 54 ++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/crates/uv/tests/it/version.rs b/crates/uv/tests/it/version.rs index 50153fe73..f1806afd8 100644 --- a/crates/uv/tests/it/version.rs +++ b/crates/uv/tests/it/version.rs @@ -933,15 +933,26 @@ fn version_get_fallback_unmanaged_json() -> Result<()> { .chain([ (r#"version": "\d+.\d+.\d+""#, r#"version": "[VERSION]""#), ( - r#"short_commit_hash": ".*""#, - r#"short_commit_hash": "[HASH]""#, + r#""short_commit_hash": ".*""#, + r#""short_commit_hash": "[HASH]""#, ), - (r#"commit_hash": ".*""#, r#"commit_hash": "[LONGHASH]""#), - (r#"commit_date": ".*""#, r#"commit_date": "[DATE]""#), - (r#"last_tag": (".*"|null)"#, r#"last_tag": "[TAG]""#), + (r#""commit_hash": ".*""#, r#""commit_hash": "[LONGHASH]""#), + (r#""commit_date": ".*""#, r#""commit_date": "[DATE]""#), + (r#""last_tag": (".*"|null)"#, r#""last_tag": "[TAG]""#), ( - r#"commits_since_last_tag": .*"#, - r#"commits_since_last_tag": [COUNT]"#, + r#""commits_since_last_tag": .*"#, + r#""commits_since_last_tag": [COUNT]"#, + ), + // This last filter normalizes output for tarball builds of uv that lack commit info + ( + r#""commit_info": null"#, + r#""commit_info": { + "short_commit_hash": "[HASH]", + "commit_hash": "[LONGHASH]", + "commit_date": "[DATE]", + "last_tag": "[TAG]", + "commits_since_last_tag": [COUNT] + }"#, ), ]) .collect::>(); @@ -954,7 +965,7 @@ fn version_get_fallback_unmanaged_json() -> Result<()> { "package_name": "uv", "version": "[VERSION]", "commit_info": { - "short_commit_hash": "[LONGHASH]", + "short_commit_hash": "[HASH]", "commit_hash": "[LONGHASH]", "commit_date": "[DATE]", "last_tag": "[TAG]", @@ -1164,15 +1175,26 @@ fn self_version_json() -> Result<()> { .chain([ (r#"version": "\d+.\d+.\d+""#, r#"version": "[VERSION]""#), ( - r#"short_commit_hash": ".*""#, - r#"short_commit_hash": "[HASH]""#, + r#""short_commit_hash": ".*""#, + r#""short_commit_hash": "[HASH]""#, ), - (r#"commit_hash": ".*""#, r#"commit_hash": "[LONGHASH]""#), - (r#"commit_date": ".*""#, r#"commit_date": "[DATE]""#), - (r#"last_tag": (".*"|null)"#, r#"last_tag": "[TAG]""#), + (r#""commit_hash": ".*""#, r#""commit_hash": "[LONGHASH]""#), + (r#""commit_date": ".*""#, r#""commit_date": "[DATE]""#), + (r#""last_tag": (".*"|null)"#, r#""last_tag": "[TAG]""#), ( - r#"commits_since_last_tag": .*"#, - r#"commits_since_last_tag": [COUNT]"#, + r#""commits_since_last_tag": .*"#, + r#""commits_since_last_tag": [COUNT]"#, + ), + // This last filter normalizes output for tarball builds of uv that lack commit info + ( + r#""commit_info": null"#, + r#""commit_info": { + "short_commit_hash": "[HASH]", + "commit_hash": "[LONGHASH]", + "commit_date": "[DATE]", + "last_tag": "[TAG]", + "commits_since_last_tag": [COUNT] + }"#, ), ]) .collect::>(); @@ -1185,7 +1207,7 @@ fn self_version_json() -> Result<()> { "package_name": "uv", "version": "[VERSION]", "commit_info": { - "short_commit_hash": "[LONGHASH]", + "short_commit_hash": "[HASH]", "commit_hash": "[LONGHASH]", "commit_date": "[DATE]", "last_tag": "[TAG]",