uv/tests: add regression test for `echo pendulum | uv pip compile -` (#2693)

I stumbled across this when writing tests for
`--emit-marker-expressions`. Namely, I observed that in CI, the `tzdata`
dependency of `pendulum` wasn't included in the `requirements.txt`
output on Windows.

@konstin [suggested] that this was a bug, so I've created a test for it.
In particular, it looks like [`tzdata` is an unconditional dependency of
`pendulum`][tzdata-unconditional].

[suggested]:
https://github.com/astral-sh/uv/pull/2651#discussion_r1539722464
[tzdata-unconditional]:
e646afbd165e58327bc5c698731107/pendulum-3.0.0-cp310-none-win_amd64.whl/pendulum-3.0.0.dist-info/METADATA#line.12
This commit is contained in:
Andrew Gallant 2024-03-27 13:04:50 -04:00 committed by GitHub
parent dc957d7322
commit d41ab0ef4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 0 deletions

View File

@ -417,6 +417,10 @@ pub fn run_and_format<'a>(
}
}
// This is a heuristic filter meant to try and make *most* of our tests
// pass whether it's on Windows or Unix. In particular, there are some very
// common Windows-only dependencies that, when removed from a resolution,
// cause the set of dependencies to be the same across platforms.
if cfg!(windows) && windows_filters {
// The optional leading +/- is for install logs, the optional next line is for lock files
let windows_only_deps = [

View File

@ -6294,3 +6294,37 @@ fn emit_marker_expression_pypy() -> Result<()> {
Ok(())
}
#[test]
fn pendulum_no_tzdata_on_windows() -> Result<()> {
let context = TestContext::new("3.12");
let requirements_in = context.temp_dir.child("requirements.in");
requirements_in.write_str("pendulum")?;
uv_snapshot!(
context.filters(),
windows_filters=false,
context.compile().arg("requirements.in"), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z requirements.in
pendulum==3.0.0
python-dateutil==2.9.0.post0
# via
# pendulum
# time-machine
six==1.16.0
# via python-dateutil
time-machine==2.14.1
# via pendulum
tzdata==2024.1
# via pendulum
----- stderr -----
Resolved 5 packages in [TIME]
"###);
Ok(())
}