Remove `version_get_fallback_unmanaged_json` test (#14786)

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.

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 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>
This commit is contained in:
Copilot 2025-07-21 14:17:06 +00:00 committed by GitHub
parent ba1319450a
commit d768dedff6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 80 deletions

View File

@ -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::<Vec<_>>();
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]