Skip to content

Commit

Permalink
uv/tests: add regression test for echo pendulum | uv pip compile - (a…
Browse files Browse the repository at this point in the history
…stral-sh#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]:
astral-sh#2651 (comment)
[tzdata-unconditional]:
https://inspector.pypi.io/project/pendulum/3.0.0/packages/67/5e/e646afbd1632bfbacdae79289d7d5879efdeeb5f5e58327bc5c698731107/pendulum-3.0.0-cp310-none-win_amd64.whl/pendulum-3.0.0.dist-info/METADATA#line.12
  • Loading branch information
BurntSushi authored Mar 27, 2024
1 parent dc957d7 commit d41ab0e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/uv/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
34 changes: 34 additions & 0 deletions crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

0 comments on commit d41ab0e

Please sign in to comment.