mirror of https://github.com/astral-sh/uv
uv/tests: add regression test from #5086
The snapshot saved here is wrong, but we'll update it in a subsequent commit.
This commit is contained in:
parent
cd1fc7c9a3
commit
412780fd99
|
|
@ -7877,6 +7877,91 @@ fn universal_unnecessary_python() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Tests the markers are propagated correctly.
|
||||
///
|
||||
/// The main issue here is that we depend on `torch` and `torchvision`
|
||||
/// directly, but our dependency on the specific `torch` version is conditional
|
||||
/// on the marker environment. This is usually fine, except in this case,
|
||||
/// `torchvision` has an unconditional dependency on `torch`, and this resulted
|
||||
/// in the markers being dropped. As a result, we'd previously write a
|
||||
/// `requirements.txt` file that unconditionally dependended on two different
|
||||
/// versions of `torch`.
|
||||
///
|
||||
/// See: <https://github.com/astral-sh/uv/issues/5086>
|
||||
#[test]
|
||||
fn universal_marker_propagation() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str(indoc::indoc! {r"
|
||||
--find-links https://download.pytorch.org/whl/torch_stable.html
|
||||
|
||||
torch==2.0.0 ; platform_machine == 'x86_64'
|
||||
torch==2.2.0 ; platform_machine != 'x86_64'
|
||||
torchvision
|
||||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.arg("-p")
|
||||
.arg("3.8")
|
||||
.arg("--universal"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --cache-dir [CACHE_DIR] requirements.in -p 3.8 --universal
|
||||
certifi==2024.2.2
|
||||
# via requests
|
||||
charset-normalizer==3.3.2
|
||||
# via requests
|
||||
filelock==3.13.1
|
||||
# via torch
|
||||
fsspec==2024.3.1
|
||||
# via torch
|
||||
idna==3.6
|
||||
# via requests
|
||||
jinja2==3.1.3
|
||||
# via torch
|
||||
markupsafe==2.1.5
|
||||
# via jinja2
|
||||
mpmath==1.3.0
|
||||
# via sympy
|
||||
networkx==3.2.1
|
||||
# via torch
|
||||
numpy==1.26.3
|
||||
# via torchvision
|
||||
pillow==10.2.0
|
||||
# via torchvision
|
||||
requests==2.31.0
|
||||
# via torchvision
|
||||
sympy==1.12
|
||||
# via torch
|
||||
torch==2.0.0
|
||||
# via
|
||||
# -r requirements.in
|
||||
# torchvision
|
||||
torch==2.2.0
|
||||
# via
|
||||
# -r requirements.in
|
||||
# torchvision
|
||||
torchvision==0.15.1+rocm5.4.2
|
||||
# via -r requirements.in
|
||||
torchvision==0.17.0+rocm5.7
|
||||
# via -r requirements.in
|
||||
typing-extensions==4.10.0
|
||||
# via torch
|
||||
urllib3==2.2.1
|
||||
# via requests
|
||||
|
||||
----- stderr -----
|
||||
warning: The requested Python version 3.8 is not available; 3.12.[X] will be used to build dependencies instead.
|
||||
Resolved 19 packages in [TIME]
|
||||
"###
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Resolve a package from a `requirements.in` file, with a `constraints.txt` file pinning one of
|
||||
/// its transitive dependencies to a specific version.
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in New Issue