Skip to content

Commit

Permalink
Use temp venv keyring
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Nov 15, 2024
1 parent afb374e commit 3433d67
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions crates/uv/tests/it/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use assert_cmd::assert::OutputAssertExt;
use assert_fs::fixture::{FileTouch, PathChild};
use std::io::Write;
use std::process::{Command, Stdio};
use std::{env, iter};
use uv_static::EnvVars;

#[test]
Expand Down Expand Up @@ -308,7 +309,9 @@ fn check_keyring_behaviours() {
"###
);

let mut child = Command::new("keyring")
let mut child = Command::new(context.interpreter())
.arg("-m")
.arg("keyring")
.arg("set")
.arg("https://test.pypi.org/legacy/?ok")
.arg("dummy")
Expand All @@ -335,6 +338,11 @@ fn check_keyring_behaviours() {

// Ok: There is a keyring entry for the user dummy.
// https://github.com/astral-sh/uv/issues/7963#issuecomment-2453558043
let path_with_venv = env::join_paths(
iter::once(context.interpreter().parent().unwrap().to_path_buf())
.chain(env::split_paths(&env::var_os("PATH").unwrap())),
)
.unwrap();
uv_snapshot!(context.filters(), context.publish()
.arg("-u")
.arg("dummy")
Expand All @@ -350,7 +358,8 @@ fn check_keyring_behaviours() {
)
// Configure keyring file location
.env("XDG_DATA_HOME", context.temp_dir.path())
.env("LOCALAPPDATA", context.temp_dir.path()), @r###"
.env("LOCALAPPDATA", context.temp_dir.path())
.env("PATH", path_with_venv), @r###"
success: false
exit_code: 2
----- stdout -----
Expand Down

0 comments on commit 3433d67

Please sign in to comment.