Created
July 8, 2025 18:14
-
-
Save zanieb/97f18a3baeba09864aa16b1d6195ae44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/crates/uv/tests/it/lock.rs b/crates/uv/tests/it/lock.rs | |
| index 5851022b8..540790fac 100644 | |
| --- a/crates/uv/tests/it/lock.rs | |
| +++ b/crates/uv/tests/it/lock.rs | |
| @@ -10033,6 +10033,156 @@ fn lock_find_links_http_wheel() -> Result<()> { | |
| Ok(()) | |
| } | |
| +#[test] | |
| +fn lock_find_links_trailing_slash() -> Result<()> { | |
| + let context = TestContext::new("3.12"); | |
| + | |
| + let pyproject_toml = context.temp_dir.child("pyproject.toml"); | |
| + pyproject_toml.write_str( | |
| + r#" | |
| + [project] | |
| + name = "project" | |
| + version = "0.1.0" | |
| + requires-python = ">=3.12" | |
| + dependencies = ["packaging==23.2"] | |
| + | |
| + [tool.uv] | |
| + no-index = true | |
| + find-links = ["https://pypi.org/simple/packaging"] | |
| + "#, | |
| + )?; | |
| + | |
| + uv_snapshot!(context.filters(), context.lock(), @r" | |
| + success: true | |
| + exit_code: 0 | |
| + ----- stdout ----- | |
| + | |
| + ----- stderr ----- | |
| + Resolved 2 packages in [TIME] | |
| + "); | |
| + | |
| + let lock = context.read("uv.lock"); | |
| + | |
| + insta::with_settings!({ | |
| + filters => context.filters(), | |
| + }, { | |
| + assert_snapshot!( | |
| + lock, @r#" | |
| + version = 1 | |
| + revision = 2 | |
| + requires-python = ">=3.12" | |
| + | |
| + [options] | |
| + exclude-newer = "2024-03-25T00:00:00Z" | |
| + | |
| + [[package]] | |
| + name = "packaging" | |
| + version = "23.2" | |
| + source = { registry = "https://pypi.org/simple/packaging" } | |
| + sdist = { url = "https://files.pythonhosted.org/packages/fb/2b/9b9c33ffed44ee921d0967086d653047286054117d584f1b1a7c22ceaf7b/packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5" } | |
| + wheels = [ | |
| + { url = "https://files.pythonhosted.org/packages/ec/1a/610693ac4ee14fcdf2d9bf3c493370e4f2ef7ae2e19217d7a237ff42367d/packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7" }, | |
| + ] | |
| + | |
| + [[package]] | |
| + name = "project" | |
| + version = "0.1.0" | |
| + source = { virtual = "." } | |
| + dependencies = [ | |
| + { name = "packaging" }, | |
| + ] | |
| + | |
| + [package.metadata] | |
| + requires-dist = [{ name = "packaging", specifier = "==23.2" }] | |
| + "# | |
| + ); | |
| + }); | |
| + | |
| + // Re-run with `--locked`. | |
| + uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###" | |
| + success: true | |
| + exit_code: 0 | |
| + ----- stdout ----- | |
| + | |
| + ----- stderr ----- | |
| + Resolved 2 packages in [TIME] | |
| + "###); | |
| + | |
| + // Add a trailing slash, which should invalidate the lockfile | |
| + let pyproject_toml = context.temp_dir.child("pyproject.toml"); | |
| + pyproject_toml.write_str( | |
| + r#" | |
| + [project] | |
| + name = "project" | |
| + version = "0.1.0" | |
| + requires-python = ">=3.12" | |
| + dependencies = ["packaging==23.2"] | |
| + | |
| + [tool.uv] | |
| + no-index = true | |
| + find-links = ["https://pypi.org/simple/packaging/"] | |
| + "#, | |
| + )?; | |
| + | |
| + // Re-run with `--locked` | |
| + uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###" | |
| + success: true | |
| + exit_code: 0 | |
| + ----- stdout ----- | |
| + | |
| + ----- stderr ----- | |
| + Resolved 2 packages in [TIME] | |
| + "###); | |
| + | |
| + uv_snapshot!(context.filters(), context.lock(), @r" | |
| + success: true | |
| + exit_code: 0 | |
| + ----- stdout ----- | |
| + | |
| + ----- stderr ----- | |
| + Resolved 2 packages in [TIME] | |
| + "); | |
| + | |
| + let lock = context.read("uv.lock"); | |
| + | |
| + insta::with_settings!({ | |
| + filters => context.filters(), | |
| + }, { | |
| + assert_snapshot!( | |
| + lock, @r#" | |
| + version = 1 | |
| + revision = 2 | |
| + requires-python = ">=3.12" | |
| + | |
| + [options] | |
| + exclude-newer = "2024-03-25T00:00:00Z" | |
| + | |
| + [[package]] | |
| + name = "packaging" | |
| + version = "23.2" | |
| + source = { registry = "https://pypi.org/simple/packaging" } | |
| + sdist = { url = "https://files.pythonhosted.org/packages/fb/2b/9b9c33ffed44ee921d0967086d653047286054117d584f1b1a7c22ceaf7b/packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5" } | |
| + wheels = [ | |
| + { url = "https://files.pythonhosted.org/packages/ec/1a/610693ac4ee14fcdf2d9bf3c493370e4f2ef7ae2e19217d7a237ff42367d/packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7" }, | |
| + ] | |
| + | |
| + [[package]] | |
| + name = "project" | |
| + version = "0.1.0" | |
| + source = { virtual = "." } | |
| + dependencies = [ | |
| + { name = "packaging" }, | |
| + ] | |
| + | |
| + [package.metadata] | |
| + requires-dist = [{ name = "packaging", specifier = "==23.2" }] | |
| + "# | |
| + ); | |
| + }); | |
| + | |
| + Ok(()) | |
| +} | |
| + | |
| /// Lock a source distribution over HTTP via `--find-links`. | |
| #[test] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment