Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Apr 10, 2024
1 parent 6305a76 commit 1b8a6c1
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7374,9 +7374,48 @@ fn emit_index_annotation_pypi_org_simple() -> Result<()> {
Ok(())
}

/// Ensure that `--emit-index-annotation` plays nicely with `--no-annotate`.
///
/// For now, `--no-annotate` doesn't affect `--emit-index-annotation`, in that we still emit the
/// index annotation, and leave `--no-annotate` to only affect the package _source_ annotations.
#[test]
fn emit_index_annotation_no_annotate() -> Result<()> {
let context = TestContext::new("3.12");

let requirements_in = context.temp_dir.child("requirements.in");
requirements_in.write_str("requests")?;

uv_snapshot!(context.compile()
.arg("requirements.in")
.arg("--emit-index-annotation")
.arg("--no-annotate"), @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 --emit-index-annotation --no-annotate
certifi==2024.2.2
# from https://pypi.org/simple
charset-normalizer==3.3.2
# from https://pypi.org/simple
idna==3.6
# from https://pypi.org/simple
requests==2.31.0
# from https://pypi.org/simple
urllib3==2.2.1
# from https://pypi.org/simple
----- stderr -----
Resolved 5 packages in [TIME]
"###
);

Ok(())
}

/// Ensure that `--emit-index-annotation` plays nicely with `--annotation-style=line`.
#[test]
fn emit_index_annotation_pypi_org_line() -> Result<()> {
fn emit_index_annotation_line() -> Result<()> {
let context = TestContext::new("3.12");

let requirements_in = context.temp_dir.child("requirements.in");
Expand Down

0 comments on commit 1b8a6c1

Please sign in to comment.