@@ -12492,3 +12492,92 @@ fn lock_python_upper_bound() -> Result<()> {
12492
12492
12493
12493
Ok(())
12494
12494
}
12495
+
12496
+ #[test]
12497
+ fn lock_strip_fragment() -> Result<()> {
12498
+ let context = TestContext::new("3.12");
12499
+
12500
+ let pyproject_toml = context.temp_dir.child("pyproject.toml");
12501
+ pyproject_toml.write_str(
12502
+ r#"
12503
+ [project]
12504
+ name = "project"
12505
+ version = "0.1.0"
12506
+ requires-python = ">=3.12"
12507
+ dependencies = ["iniconfig @ https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl#sha256=b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"]
12508
+
12509
+ [build-system]
12510
+ requires = ["setuptools>=42"]
12511
+ build-backend = "setuptools.build_meta"
12512
+ "#,
12513
+ )?;
12514
+
12515
+ uv_snapshot!(context.filters(), context.lock(), @r###"
12516
+ success: true
12517
+ exit_code: 0
12518
+ ----- stdout -----
12519
+
12520
+ ----- stderr -----
12521
+ Resolved 2 packages in [TIME]
12522
+ "###);
12523
+
12524
+ let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock")).unwrap();
12525
+
12526
+ insta::with_settings!({
12527
+ filters => context.filters(),
12528
+ }, {
12529
+ assert_snapshot!(
12530
+ lock, @r###"
12531
+ version = 1
12532
+ requires-python = ">=3.12"
12533
+
12534
+ [options]
12535
+ exclude-newer = "2024-03-25T00:00:00Z"
12536
+
12537
+ [[package]]
12538
+ name = "iniconfig"
12539
+ version = "2.0.0"
12540
+ source = { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl" }
12541
+ wheels = [
12542
+ { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374" },
12543
+ ]
12544
+
12545
+ [[package]]
12546
+ name = "project"
12547
+ version = "0.1.0"
12548
+ source = { editable = "." }
12549
+ dependencies = [
12550
+ { name = "iniconfig" },
12551
+ ]
12552
+
12553
+ [package.metadata]
12554
+ requires-dist = [{ name = "iniconfig", url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl#sha256=b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374" }]
12555
+ "###
12556
+ );
12557
+ });
12558
+
12559
+ // Re-run with `--locked`.
12560
+ uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
12561
+ success: true
12562
+ exit_code: 0
12563
+ ----- stdout -----
12564
+
12565
+ ----- stderr -----
12566
+ Resolved 2 packages in [TIME]
12567
+ "###);
12568
+
12569
+ // Install from the lockfile.
12570
+ uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###"
12571
+ success: true
12572
+ exit_code: 0
12573
+ ----- stdout -----
12574
+
12575
+ ----- stderr -----
12576
+ Prepared 2 packages in [TIME]
12577
+ Installed 2 packages in [TIME]
12578
+ + iniconfig==2.0.0 (from https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl)
12579
+ + project==0.1.0 (from file://[TEMP_DIR]/)
12580
+ "###);
12581
+
12582
+ Ok(())
12583
+ }
0 commit comments