From d768dedff674de659ae8c7fc3d03faf41a13874d Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 14:17:06 +0000 Subject: [PATCH] Remove `version_get_fallback_unmanaged_json` test (#14786) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `version_get_fallback_unmanaged_json` test was failing when running tests outside of a git checkout (e.g., from a release tarball) due to inconsistent behavior based on git availability. The test had conditional logic that expected different outcomes depending on whether `git_version_info_expected()` returned true or false: - In git checkouts: Expected failure with "The project is marked as unmanaged" error - Outside git checkouts: Expected success with fallback behavior showing version info However, the fallback behavior was removed in version 0.8.0, making this test obsolete. All other similar tests (`version_get_fallback_unmanaged`, `version_get_fallback_unmanaged_short`, `version_get_fallback_unmanaged_strict`) consistently expect failure when a project is marked as unmanaged, regardless of git availability. This change removes the problematic test entirely, as suggested by @zanieb. All remaining version tests (51 total) continue to pass. Fixes #14785. --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com> --- crates/uv/tests/it/version.rs | 80 ----------------------------------- 1 file changed, 80 deletions(-) diff --git a/crates/uv/tests/it/version.rs b/crates/uv/tests/it/version.rs index 78dd64252..e5f6e1687 100644 --- a/crates/uv/tests/it/version.rs +++ b/crates/uv/tests/it/version.rs @@ -1545,86 +1545,6 @@ fn git_version_info_expected() -> bool { git_dir.exists() } -// version_get_fallback with `--json` -#[test] -fn version_get_fallback_unmanaged_json() -> Result<()> { - let context = TestContext::new("3.12"); - - let pyproject_toml = context.temp_dir.child("pyproject.toml"); - pyproject_toml.write_str( - r#" - [project] - name = "myapp" - version = "0.1.2" - - [tool.uv] - managed = false - "#, - )?; - - let filters = context - .filters() - .into_iter() - .chain([ - ( - r#"version": "\d+\.\d+\.\d+(-(alpha|beta|rc)\.\d+)?(\+\d+)?""#, - r#"version": "[VERSION]""#, - ), - ( - 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#"commits_since_last_tag": .*"#, - r#"commits_since_last_tag": [COUNT]"#, - ), - ]) - .collect::>(); - if git_version_info_expected() { - uv_snapshot!(filters, context.version() - .arg("--output-format").arg("json"), @r" - success: false - exit_code: 2 - ----- stdout ----- - - ----- stderr ----- - error: The project is marked as unmanaged: `[TEMP_DIR]/` - "); - } else { - uv_snapshot!(filters, context.version() - .arg("--output-format").arg("json"), @r#" - success: true - exit_code: 0 - ----- stdout ----- - { - "package_name": "uv", - "version": "[VERSION]", - "commit_info": null - } - - ----- stderr ----- - warning: Failed to read project metadata (The project is marked as unmanaged: `[TEMP_DIR]/`). Running `uv self version` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error. - "#); - } - - let pyproject = fs_err::read_to_string(&pyproject_toml)?; - assert_snapshot!( - pyproject, - @r#" - [project] - name = "myapp" - version = "0.1.2" - - [tool.uv] - managed = false - "# - ); - Ok(()) -} - // Should error if this pyproject.toml isn't usable for whatever reason // and --project was passed explicitly. #[test]