Split the TestContext into a dedicated uv-test crate (#17551)
This commit is contained in:
Generated
+31
-3
@@ -5628,7 +5628,6 @@ dependencies = [
|
||||
"astral-version-ranges",
|
||||
"axoupdater",
|
||||
"backon",
|
||||
"base64 0.22.1",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"clap",
|
||||
@@ -5646,7 +5645,6 @@ dependencies = [
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"ignore",
|
||||
"indexmap",
|
||||
"indicatif",
|
||||
"indoc",
|
||||
@@ -5666,7 +5664,6 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"similar",
|
||||
"tar",
|
||||
"tempfile",
|
||||
"textwrap",
|
||||
@@ -5724,6 +5721,7 @@ dependencies = [
|
||||
"uv-settings",
|
||||
"uv-shell",
|
||||
"uv-static",
|
||||
"uv-test",
|
||||
"uv-tool",
|
||||
"uv-torch",
|
||||
"uv-trampoline-builder",
|
||||
@@ -7074,6 +7072,36 @@ dependencies = [
|
||||
"uv-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uv-test"
|
||||
version = "0.0.20"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"assert_cmd",
|
||||
"assert_fs",
|
||||
"base64 0.22.1",
|
||||
"fs-err",
|
||||
"futures",
|
||||
"ignore",
|
||||
"indoc",
|
||||
"insta",
|
||||
"itertools 0.14.0",
|
||||
"predicates",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"similar",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"uv-cache",
|
||||
"uv-client",
|
||||
"uv-configuration",
|
||||
"uv-fs",
|
||||
"uv-preview",
|
||||
"uv-python",
|
||||
"uv-static",
|
||||
"uv-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uv-tool"
|
||||
version = "0.0.20"
|
||||
|
||||
@@ -66,6 +66,7 @@ uv-shell = { version = "0.0.20", path = "crates/uv-shell" }
|
||||
uv-small-str = { version = "0.0.20", path = "crates/uv-small-str" }
|
||||
uv-state = { version = "0.0.20", path = "crates/uv-state" }
|
||||
uv-static = { version = "0.0.20", path = "crates/uv-static" }
|
||||
uv-test = { version = "0.0.20", path = "crates/uv-test" }
|
||||
uv-tool = { version = "0.0.20", path = "crates/uv-tool" }
|
||||
uv-torch = { version = "0.0.20", path = "crates/uv-torch" }
|
||||
uv-trampoline-builder = { version = "0.0.20", path = "crates/uv-trampoline-builder" }
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
[package]
|
||||
name = "uv-test"
|
||||
version = "0.0.20"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
# When enabled, git tests are run and the git CLI is allowed.
|
||||
git = []
|
||||
# When enabled, tracing duration export is supported.
|
||||
tracing-durations-export = []
|
||||
|
||||
[dependencies]
|
||||
uv-cache = { workspace = true, features = ["clap"] }
|
||||
uv-client = { workspace = true }
|
||||
uv-configuration = { workspace = true }
|
||||
uv-fs = { workspace = true }
|
||||
uv-preview = { workspace = true }
|
||||
uv-python = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-version = { workspace = true }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
assert_cmd = { workspace = true }
|
||||
assert_fs = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
fs-err = { workspace = true, features = ["tokio"] }
|
||||
futures = { workspace = true }
|
||||
ignore = { workspace = true }
|
||||
indoc = { workspace = true }
|
||||
insta = { workspace = true, features = ["filters"] }
|
||||
itertools = { workspace = true }
|
||||
predicates = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
similar = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
@@ -67,6 +67,49 @@ pub fn packse_index_url() -> String {
|
||||
))
|
||||
}
|
||||
|
||||
/// Create a new [`TestContext`] with the given Python version.
|
||||
///
|
||||
/// Creates a virtual environment for the test.
|
||||
///
|
||||
/// This macro captures the uv binary path at compile time using `env!("CARGO_BIN_EXE_uv")`,
|
||||
/// which is only available in the test crate.
|
||||
#[macro_export]
|
||||
macro_rules! test_context {
|
||||
($python_version:expr) => {
|
||||
$crate::TestContext::new_with_bin(
|
||||
$python_version,
|
||||
std::path::PathBuf::from(env!("CARGO_BIN_EXE_uv")),
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
/// Create a new [`TestContext`] with zero or more Python versions.
|
||||
///
|
||||
/// Unlike [`test_context!`], this does not create a virtual environment.
|
||||
///
|
||||
/// This macro captures the uv binary path at compile time using `env!("CARGO_BIN_EXE_uv")`,
|
||||
/// which is only available in the test crate.
|
||||
#[macro_export]
|
||||
macro_rules! test_context_with_versions {
|
||||
($python_versions:expr) => {
|
||||
$crate::TestContext::new_with_versions_and_bin(
|
||||
$python_versions,
|
||||
std::path::PathBuf::from(env!("CARGO_BIN_EXE_uv")),
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
/// Return the path to the uv binary.
|
||||
///
|
||||
/// This macro captures the uv binary path at compile time using `env!("CARGO_BIN_EXE_uv")`,
|
||||
/// which is only available in the test crate.
|
||||
#[macro_export]
|
||||
macro_rules! get_bin {
|
||||
() => {
|
||||
std::path::PathBuf::from(env!("CARGO_BIN_EXE_uv"))
|
||||
};
|
||||
}
|
||||
|
||||
#[doc(hidden)] // Macro and test context only, don't use directly.
|
||||
pub const INSTA_FILTERS: &[(&str, &str)] = &[
|
||||
(r"--cache-dir [^\s]+", "--cache-dir [CACHE_DIR]"),
|
||||
@@ -112,6 +155,9 @@ pub struct TestContext {
|
||||
/// All the Python versions available during this test context.
|
||||
pub python_versions: Vec<(PythonVersion, PathBuf)>,
|
||||
|
||||
/// Path to the uv binary.
|
||||
uv_bin: PathBuf,
|
||||
|
||||
/// Standard filters for this test context.
|
||||
filters: Vec<(String, String)>,
|
||||
|
||||
@@ -123,17 +169,17 @@ pub struct TestContext {
|
||||
}
|
||||
|
||||
impl TestContext {
|
||||
/// Create a new test context with a virtual environment.
|
||||
/// Create a new test context with a virtual environment and explicit uv binary path.
|
||||
///
|
||||
/// See [`TestContext::new_with_versions`] if multiple versions are needed or
|
||||
/// if creation of the virtual environment should be deferred.
|
||||
pub fn new(python_version: &str) -> Self {
|
||||
let new = Self::new_with_versions(&[python_version]);
|
||||
/// This is called by the `test_context!` macro.
|
||||
pub fn new_with_bin(python_version: &str, uv_bin: PathBuf) -> Self {
|
||||
let new = Self::new_with_versions_and_bin(&[python_version], uv_bin);
|
||||
new.create_venv();
|
||||
new
|
||||
}
|
||||
|
||||
/// Set the "exclude newer" timestamp for all commands in this context.
|
||||
#[must_use]
|
||||
pub fn with_exclude_newer(mut self, exclude_newer: &str) -> Self {
|
||||
self.extra_env
|
||||
.push((EnvVars::UV_EXCLUDE_NEWER.into(), exclude_newer.into()));
|
||||
@@ -141,6 +187,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Set the "http timeout" for all commands in this context.
|
||||
#[must_use]
|
||||
pub fn with_http_timeout(mut self, http_timeout: &str) -> Self {
|
||||
self.extra_env
|
||||
.push((EnvVars::UV_HTTP_TIMEOUT.into(), http_timeout.into()));
|
||||
@@ -148,6 +195,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Set the "concurrent installs" for all commands in this context.
|
||||
#[must_use]
|
||||
pub fn with_concurrent_installs(mut self, concurrent_installs: &str) -> Self {
|
||||
self.extra_env.push((
|
||||
EnvVars::UV_CONCURRENT_INSTALLS.into(),
|
||||
@@ -196,6 +244,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Add extra standard filtering for Windows-compatible missing file errors.
|
||||
#[must_use]
|
||||
pub fn with_filtered_missing_file_error(mut self) -> Self {
|
||||
// The exact message string depends on the system language, so we remove it.
|
||||
// We want to only remove the phrase after `Caused by:`
|
||||
@@ -425,6 +474,7 @@ impl TestContext {
|
||||
/// example, sometimes it's dependent on whether `/tmp` and `~/.local` live
|
||||
/// on the same file system.)
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn with_filtered_link_mode_warning(mut self) -> Self {
|
||||
let pattern = "warning: Failed to hardlink files; .*\n.*\n.*\n";
|
||||
self.filters.push((pattern.to_string(), String::new()));
|
||||
@@ -433,6 +483,7 @@ impl TestContext {
|
||||
|
||||
/// Adds a filter for platform-specific errors when a file is not executable.
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn with_filtered_not_executable(mut self) -> Self {
|
||||
let pattern = if cfg!(unix) {
|
||||
r"Permission denied \(os error 13\)"
|
||||
@@ -445,6 +496,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Adds a filter that ignores platform information in a Python installation key.
|
||||
#[must_use]
|
||||
pub fn with_filtered_python_keys(mut self) -> Self {
|
||||
// Filter platform keys
|
||||
let platform_re = r"(?x)
|
||||
@@ -479,6 +531,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Adds a filter that replaces the latest Python patch versions with `[LATEST]` placeholder.
|
||||
#[must_use]
|
||||
pub fn with_filtered_latest_python_versions(mut self) -> Self {
|
||||
// Filter the latest patch versions with [LATEST] placeholder
|
||||
// The order matters - we want to match the full version first
|
||||
@@ -499,6 +552,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Add a filter that ignores temporary directory in path.
|
||||
#[must_use]
|
||||
pub fn with_filtered_windows_temp_dir(mut self) -> Self {
|
||||
let pattern = regex::escape(
|
||||
&self
|
||||
@@ -522,6 +576,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Adds filters for non-deterministic `CycloneDX` data
|
||||
#[must_use]
|
||||
pub fn with_cyclonedx_filters(mut self) -> Self {
|
||||
self.filters.push((
|
||||
r"urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}".to_string(),
|
||||
@@ -591,6 +646,7 @@ impl TestContext {
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_versions_as_managed(mut self, versions: &[&str]) -> Self {
|
||||
self.extra_env.push((
|
||||
EnvVars::UV_INTERNAL__TEST_PYTHON_MANAGED.into(),
|
||||
@@ -601,12 +657,14 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Add a custom filter to the `TestContext`.
|
||||
#[must_use]
|
||||
pub fn with_filter(mut self, filter: (impl Into<String>, impl Into<String>)) -> Self {
|
||||
self.filters.push((filter.0.into(), filter.1.into()));
|
||||
self
|
||||
}
|
||||
|
||||
// Unsets the git credential helper using temp home gitconfig
|
||||
#[must_use]
|
||||
pub fn with_unset_git_credential_helper(self) -> Self {
|
||||
let git_config = self.home_dir.child(".gitconfig");
|
||||
git_config
|
||||
@@ -620,6 +678,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// Clear filters on `TestContext`.
|
||||
#[must_use]
|
||||
pub fn clear_filters(mut self) -> Self {
|
||||
self.filters.clear();
|
||||
self
|
||||
@@ -641,13 +700,13 @@ impl TestContext {
|
||||
.join("tests")
|
||||
}
|
||||
|
||||
/// Create a new test context with multiple Python versions.
|
||||
/// Create a new test context with multiple Python versions and explicit uv binary path.
|
||||
///
|
||||
/// Does not create a virtual environment by default, but the first Python version
|
||||
/// can be used to create a virtual environment with [`TestContext::create_venv`].
|
||||
///
|
||||
/// See [`TestContext::new`] if only a single version is desired.
|
||||
pub fn new_with_versions(python_versions: &[&str]) -> Self {
|
||||
/// This is called by the `test_context_with_versions!` macro.
|
||||
pub fn new_with_versions_and_bin(python_versions: &[&str], uv_bin: PathBuf) -> Self {
|
||||
let bucket = Self::test_bucket_dir();
|
||||
fs_err::create_dir_all(&bucket).expect("Failed to create test bucket");
|
||||
|
||||
@@ -671,7 +730,7 @@ impl TestContext {
|
||||
fs_err::create_dir_all(&bin_dir).expect("Failed to create test bin directory");
|
||||
|
||||
// When the `git` feature is disabled, enforce that the test suite does not use `git`
|
||||
if cfg!(not(feature = "test-git")) {
|
||||
if cfg!(not(feature = "git")) {
|
||||
Self::disallow_git_cli(&bin_dir).expect("Failed to setup disallowed `git` command");
|
||||
}
|
||||
|
||||
@@ -729,7 +788,7 @@ impl TestContext {
|
||||
let mut filters = Vec::new();
|
||||
|
||||
filters.extend(
|
||||
Self::path_patterns(get_bin())
|
||||
Self::path_patterns(&uv_bin)
|
||||
.into_iter()
|
||||
.map(|pattern| (pattern, "[UV]".to_string())),
|
||||
);
|
||||
@@ -917,6 +976,7 @@ impl TestContext {
|
||||
workspace_root,
|
||||
python_version,
|
||||
python_versions,
|
||||
uv_bin,
|
||||
filters,
|
||||
extra_env: vec![],
|
||||
_root: root,
|
||||
@@ -925,7 +985,7 @@ impl TestContext {
|
||||
|
||||
/// Create a uv command for testing.
|
||||
pub fn command(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
}
|
||||
@@ -952,6 +1012,7 @@ impl TestContext {
|
||||
///
|
||||
/// You can find the default filters in <https://github.com/git-lfs/git-lfs/blob/v3.7.1/lfs/attribute.go#L66-L71>
|
||||
/// We set required to true to get a full stacktrace when these commands fail.
|
||||
#[must_use]
|
||||
pub fn with_git_lfs_config(mut self) -> Self {
|
||||
let git_lfs_config = self.root.child(".gitconfig");
|
||||
git_lfs_config
|
||||
@@ -1072,7 +1133,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `pip compile` command for testing.
|
||||
pub fn pip_compile(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("compile");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1080,14 +1141,14 @@ impl TestContext {
|
||||
|
||||
/// Create a `pip compile` command for testing.
|
||||
pub fn pip_sync(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("sync");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
}
|
||||
|
||||
pub fn pip_show(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("show");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1095,7 +1156,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `pip freeze` command with options shared across scenarios.
|
||||
pub fn pip_freeze(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("freeze");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1103,14 +1164,14 @@ impl TestContext {
|
||||
|
||||
/// Create a `pip check` command with options shared across scenarios.
|
||||
pub fn pip_check(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("check");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
}
|
||||
|
||||
pub fn pip_list(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("list");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1118,7 +1179,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv venv` command
|
||||
pub fn venv(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("venv");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1126,7 +1187,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `pip install` command with options shared across scenarios.
|
||||
pub fn pip_install(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("install");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1134,7 +1195,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `pip uninstall` command with options shared across scenarios.
|
||||
pub fn pip_uninstall(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("uninstall");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1142,7 +1203,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `pip tree` command for testing.
|
||||
pub fn pip_tree(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("tree");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1150,7 +1211,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `pip debug` command for testing.
|
||||
pub fn pip_debug(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("pip").arg("debug");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1158,7 +1219,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv help` command with options shared across scenarios.
|
||||
pub fn help(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("help");
|
||||
self.add_shared_env(&mut command, false);
|
||||
command
|
||||
@@ -1167,7 +1228,7 @@ impl TestContext {
|
||||
/// Create a `uv init` command with options shared across scenarios and
|
||||
/// isolated from any git repository that may exist in a parent directory.
|
||||
pub fn init(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("init");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1175,7 +1236,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv sync` command with options shared across scenarios.
|
||||
pub fn sync(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("sync");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1183,7 +1244,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv lock` command with options shared across scenarios.
|
||||
pub fn lock(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("lock");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1191,7 +1252,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv workspace metadata` command with options shared across scenarios.
|
||||
pub fn workspace_metadata(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("workspace").arg("metadata");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1199,7 +1260,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv workspace dir` command with options shared across scenarios.
|
||||
pub fn workspace_dir(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("workspace").arg("dir");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1207,7 +1268,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv workspace list` command with options shared across scenarios.
|
||||
pub fn workspace_list(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("workspace").arg("list");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1215,7 +1276,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv export` command with options shared across scenarios.
|
||||
pub fn export(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("export");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1223,7 +1284,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv format` command with options shared across scenarios.
|
||||
pub fn format(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("format");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1231,28 +1292,28 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv build` command with options shared across scenarios.
|
||||
pub fn build(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("build");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
}
|
||||
|
||||
pub fn version(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("version");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
}
|
||||
|
||||
pub fn self_version(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("self").arg("version");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
}
|
||||
|
||||
pub fn self_update(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("self").arg("update");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1260,7 +1321,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv publish` command with options shared across scenarios.
|
||||
pub fn publish(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("publish");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1268,7 +1329,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv python find` command with options shared across scenarios.
|
||||
pub fn python_find(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command
|
||||
.arg("python")
|
||||
.arg("find")
|
||||
@@ -1280,7 +1341,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv python list` command with options shared across scenarios.
|
||||
pub fn python_list(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command
|
||||
.arg("python")
|
||||
.arg("list")
|
||||
@@ -1291,7 +1352,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv python install` command with options shared across scenarios.
|
||||
pub fn python_install(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("python").arg("install");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1299,7 +1360,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv python uninstall` command with options shared across scenarios.
|
||||
pub fn python_uninstall(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("python").arg("uninstall");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1307,7 +1368,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv python upgrade` command with options shared across scenarios.
|
||||
pub fn python_upgrade(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("python").arg("upgrade");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1315,7 +1376,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv python pin` command with options shared across scenarios.
|
||||
pub fn python_pin(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("python").arg("pin");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1323,7 +1384,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv python dir` command with options shared across scenarios.
|
||||
pub fn python_dir(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("python").arg("dir");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1331,7 +1392,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv run` command with options shared across scenarios.
|
||||
pub fn run(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("run").env(EnvVars::UV_SHOW_RESOLUTION, "1");
|
||||
self.add_shared_options(&mut command, true);
|
||||
command
|
||||
@@ -1339,7 +1400,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv tool run` command with options shared across scenarios.
|
||||
pub fn tool_run(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command
|
||||
.arg("tool")
|
||||
.arg("run")
|
||||
@@ -1350,7 +1411,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv upgrade run` command with options shared across scenarios.
|
||||
pub fn tool_upgrade(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("tool").arg("upgrade");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1358,7 +1419,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv tool install` command with options shared across scenarios.
|
||||
pub fn tool_install(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("tool").arg("install");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1366,7 +1427,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv tool list` command with options shared across scenarios.
|
||||
pub fn tool_list(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("tool").arg("list");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1374,7 +1435,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv tool dir` command with options shared across scenarios.
|
||||
pub fn tool_dir(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("tool").arg("dir");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1382,7 +1443,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv tool uninstall` command with options shared across scenarios.
|
||||
pub fn tool_uninstall(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("tool").arg("uninstall");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1390,7 +1451,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv add` command for the given requirements.
|
||||
pub fn add(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("add");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1398,7 +1459,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv remove` command for the given requirements.
|
||||
pub fn remove(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("remove");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1406,7 +1467,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv tree` command with options shared across scenarios.
|
||||
pub fn tree(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("tree");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1414,7 +1475,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv cache clean` command.
|
||||
pub fn clean(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("cache").arg("clean");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1422,7 +1483,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv cache prune` command.
|
||||
pub fn prune(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("cache").arg("prune");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1430,7 +1491,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv cache size` command.
|
||||
pub fn cache_size(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("cache").arg("size");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1440,7 +1501,7 @@ impl TestContext {
|
||||
///
|
||||
/// Note that this command is hidden and only invoking it through a build frontend is supported.
|
||||
pub fn build_backend(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("build-backend");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1489,7 +1550,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv auth login` command.
|
||||
pub fn auth_login(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("auth").arg("login");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1497,7 +1558,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv auth logout` command.
|
||||
pub fn auth_logout(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("auth").arg("logout");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1505,7 +1566,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv auth helper --protocol bazel get` command.
|
||||
pub fn auth_helper(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("auth").arg("helper");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1513,7 +1574,7 @@ impl TestContext {
|
||||
|
||||
/// Create a `uv auth token` command.
|
||||
pub fn auth_token(&self) -> Command {
|
||||
let mut command = Self::new_command();
|
||||
let mut command = self.new_command();
|
||||
command.arg("auth").arg("token");
|
||||
self.add_shared_options(&mut command, false);
|
||||
command
|
||||
@@ -1640,7 +1701,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
/// For when we add pypy to the test suite.
|
||||
#[expect(clippy::unused_self)]
|
||||
#[allow(clippy::unused_self)]
|
||||
pub fn python_kind(&self) -> &'static str {
|
||||
"python"
|
||||
}
|
||||
@@ -1671,7 +1732,7 @@ impl TestContext {
|
||||
.as_ref()
|
||||
.expect("A Python version must be provided to create a test virtual environment"),
|
||||
);
|
||||
create_venv_from_executable(&self.venv, &self.cache_dir, &executable);
|
||||
create_venv_from_executable(&self.venv, &self.cache_dir, &executable, &self.uv_bin);
|
||||
}
|
||||
|
||||
/// Copies the files from the ecosystem project given into this text
|
||||
@@ -1731,8 +1792,8 @@ impl TestContext {
|
||||
|
||||
/// Creates a new `Command` that is intended to be suitable for use in
|
||||
/// all tests.
|
||||
fn new_command() -> Command {
|
||||
Self::new_command_with(&get_bin())
|
||||
fn new_command(&self) -> Command {
|
||||
Self::new_command_with(&self.uv_bin)
|
||||
}
|
||||
|
||||
/// Creates a new `Command` that is intended to be suitable for use in
|
||||
@@ -1833,8 +1894,13 @@ pub fn get_python(version: &PythonVersion) -> PathBuf {
|
||||
}
|
||||
|
||||
/// Create a virtual environment at the given path.
|
||||
pub fn create_venv_from_executable<P: AsRef<Path>>(path: P, cache_dir: &ChildPath, python: &Path) {
|
||||
TestContext::new_command_with(&get_bin())
|
||||
pub fn create_venv_from_executable<P: AsRef<Path>>(
|
||||
path: P,
|
||||
cache_dir: &ChildPath,
|
||||
python: &Path,
|
||||
uv_bin: &Path,
|
||||
) {
|
||||
TestContext::new_command_with(uv_bin)
|
||||
.arg("venv")
|
||||
.arg(path.as_ref().as_os_str())
|
||||
.arg("--clear")
|
||||
@@ -1848,13 +1914,6 @@ pub fn create_venv_from_executable<P: AsRef<Path>>(path: P, cache_dir: &ChildPat
|
||||
ChildPath::new(path.as_ref()).assert(predicate::path::is_dir());
|
||||
}
|
||||
|
||||
/// Returns the uv binary that cargo built before launching the tests.
|
||||
///
|
||||
/// <https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates>
|
||||
pub fn get_bin() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_BIN_EXE_uv"))
|
||||
}
|
||||
|
||||
/// Create a `PATH` with the requested Python versions available in order.
|
||||
///
|
||||
/// Generally this should be used with `UV_TEST_PYTHON_PATH`.
|
||||
@@ -2228,37 +2287,33 @@ macro_rules! function_name {
|
||||
///
|
||||
/// By default, the filters will search for the generally windows-only deps colorama and tzdata,
|
||||
/// filter them out and decrease the package counts by one for each match.
|
||||
#[allow(unused_macros)]
|
||||
#[macro_export]
|
||||
macro_rules! uv_snapshot {
|
||||
($spawnable:expr, @$snapshot:literal) => {{
|
||||
uv_snapshot!($crate::common::INSTA_FILTERS.to_vec(), $spawnable, @$snapshot)
|
||||
uv_snapshot!($crate::INSTA_FILTERS.to_vec(), $spawnable, @$snapshot)
|
||||
}};
|
||||
($filters:expr, $spawnable:expr, @$snapshot:literal) => {{
|
||||
// Take a reference for backwards compatibility with the vec-expecting insta filters.
|
||||
let (snapshot, output) = $crate::common::run_and_format($spawnable, &$filters, $crate::function_name!(), Some($crate::common::WindowsFilters::Platform), None);
|
||||
let (snapshot, output) = $crate::run_and_format($spawnable, &$filters, $crate::function_name!(), Some($crate::WindowsFilters::Platform), None);
|
||||
::insta::assert_snapshot!(snapshot, @$snapshot);
|
||||
output
|
||||
}};
|
||||
($filters:expr, $spawnable:expr, input=$input:expr, @$snapshot:literal) => {{
|
||||
// Take a reference for backwards compatibility with the vec-expecting insta filters.
|
||||
let (snapshot, output) = $crate::common::run_and_format($spawnable, &$filters, $crate::function_name!(), Some($crate::common::WindowsFilters::Platform), Some($input));
|
||||
let (snapshot, output) = $crate::run_and_format($spawnable, &$filters, $crate::function_name!(), Some($crate::WindowsFilters::Platform), Some($input));
|
||||
::insta::assert_snapshot!(snapshot, @$snapshot);
|
||||
output
|
||||
}};
|
||||
($filters:expr, windows_filters=false, $spawnable:expr, @$snapshot:literal) => {{
|
||||
// Take a reference for backwards compatibility with the vec-expecting insta filters.
|
||||
let (snapshot, output) = $crate::common::run_and_format($spawnable, &$filters, $crate::function_name!(), None, None);
|
||||
let (snapshot, output) = $crate::run_and_format($spawnable, &$filters, $crate::function_name!(), None, None);
|
||||
::insta::assert_snapshot!(snapshot, @$snapshot);
|
||||
output
|
||||
}};
|
||||
($filters:expr, universal_windows_filters=true, $spawnable:expr, @$snapshot:literal) => {{
|
||||
// Take a reference for backwards compatibility with the vec-expecting insta filters.
|
||||
let (snapshot, output) = $crate::common::run_and_format($spawnable, &$filters, $crate::function_name!(), Some($crate::common::WindowsFilters::Universal), None);
|
||||
let (snapshot, output) = $crate::run_and_format($spawnable, &$filters, $crate::function_name!(), Some($crate::WindowsFilters::Universal), None);
|
||||
::insta::assert_snapshot!(snapshot, @$snapshot);
|
||||
output
|
||||
}};
|
||||
}
|
||||
|
||||
/// <https://stackoverflow.com/a/31749071/3549270>
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) use uv_snapshot;
|
||||
@@ -125,11 +125,11 @@ embed-manifest = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
uv-publish = { workspace = true, features = ["test"] }
|
||||
uv-test = { workspace = true }
|
||||
|
||||
assert_cmd = { workspace = true }
|
||||
assert_fs = { workspace = true }
|
||||
backon = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
byteorder = { workspace = true }
|
||||
bytes = { workspace = true }
|
||||
filetime = { workspace = true }
|
||||
@@ -137,14 +137,12 @@ flate2 = { workspace = true, default-features = false }
|
||||
http-body-util = { workspace = true }
|
||||
hyper = { workspace = true }
|
||||
hyper-util = { workspace = true }
|
||||
ignore = { workspace = true }
|
||||
indoc = { workspace = true }
|
||||
insta = { workspace = true }
|
||||
predicates = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
reqwest = { workspace = true, features = ["blocking"], default-features = false }
|
||||
sha2 = { workspace = true }
|
||||
similar = { workspace = true }
|
||||
tar = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
@@ -169,7 +167,7 @@ performance-memory-allocator = ["dep:uv-performance-memory-allocator"]
|
||||
self-update = ["axoupdater", "uv-cli/self-update"]
|
||||
|
||||
# Features for development only.
|
||||
tracing-durations-export = ["dep:tracing-durations-export", "uv-resolver/tracing-durations-export", "uv-settings/tracing-durations-export"]
|
||||
tracing-durations-export = ["dep:tracing-durations-export", "uv-resolver/tracing-durations-export", "uv-settings/tracing-durations-export", "uv-test/tracing-durations-export"]
|
||||
|
||||
# Features that only apply when running tests, no-ops otherwise.
|
||||
test-defaults = [
|
||||
@@ -187,7 +185,7 @@ test-defaults = [
|
||||
# Introduces a testing dependency on crates.io.
|
||||
test-crates-io = []
|
||||
# Introduces a testing dependency on Git.
|
||||
test-git = []
|
||||
test-git = ["uv-test/git"]
|
||||
# Introduces a testing dependency on Git LFS.
|
||||
test-git-lfs = ["test-git"]
|
||||
# Introduces a testing dependency on PyPI.
|
||||
|
||||
+35
-35
@@ -3,12 +3,12 @@ use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::{fixture::PathChild, prelude::FileWriteStr};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn add_package_native_auth_realm() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_real_home();
|
||||
let context = uv_test::test_context!("3.12").with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -117,7 +117,7 @@ fn add_package_native_auth_realm() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn add_package_native_auth() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_real_home();
|
||||
let context = uv_test::test_context!("3.12").with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -227,7 +227,7 @@ fn add_package_native_auth() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn token_native_auth() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -389,7 +389,7 @@ fn token_native_auth() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn token_native_auth_realm() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -588,7 +588,7 @@ fn token_native_auth_realm() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn login_native_auth() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -663,7 +663,7 @@ fn login_native_auth() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn login_token_native_auth() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -695,7 +695,7 @@ fn login_token_native_auth() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn logout_native_auth() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -857,7 +857,7 @@ fn logout_native_auth() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn logout_token_native_auth() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -899,7 +899,7 @@ fn logout_token_native_auth() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn login_native_auth_url() {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// A domain-only service name gets https:// prepended
|
||||
uv_snapshot!(context.auth_login()
|
||||
@@ -1073,7 +1073,7 @@ fn login_native_auth_url() {
|
||||
|
||||
#[test]
|
||||
fn login_text_store() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login with a username and password
|
||||
uv_snapshot!(context.auth_login()
|
||||
@@ -1205,7 +1205,7 @@ fn login_text_store() {
|
||||
#[test]
|
||||
#[expect(clippy::disallowed_types)]
|
||||
fn login_password_stdin() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Create a temporary file with the password
|
||||
let password_file = context.temp_dir.child("password.txt");
|
||||
@@ -1248,7 +1248,7 @@ fn login_password_stdin() -> Result<()> {
|
||||
#[test]
|
||||
#[expect(clippy::disallowed_types)]
|
||||
fn login_token_stdin() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Create a temporary file with the token
|
||||
let token_file = context.temp_dir.child("token.txt");
|
||||
@@ -1286,7 +1286,7 @@ fn login_token_stdin() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn token_text_store() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login first
|
||||
context
|
||||
@@ -1351,7 +1351,7 @@ fn token_text_store() {
|
||||
|
||||
#[test]
|
||||
fn logout_text_store() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login first
|
||||
context
|
||||
@@ -1415,7 +1415,7 @@ fn logout_text_store() {
|
||||
|
||||
#[test]
|
||||
fn auth_disabled_provider_uses_text_store() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login with disabled provider should use text store
|
||||
uv_snapshot!(context.auth_login()
|
||||
@@ -1454,7 +1454,7 @@ fn auth_disabled_provider_uses_text_store() {
|
||||
|
||||
#[test]
|
||||
fn login_text_store_strips_simple_suffix() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login with `/simple` suffix - should strip it and store credentials for the root URL
|
||||
uv_snapshot!(context.auth_login()
|
||||
@@ -1539,7 +1539,7 @@ fn login_text_store_strips_simple_suffix() {
|
||||
|
||||
#[test]
|
||||
fn logout_text_store_strips_simple_suffix() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login with `/simple` suffix first
|
||||
context
|
||||
@@ -1594,7 +1594,7 @@ fn logout_text_store_strips_simple_suffix() {
|
||||
|
||||
#[test]
|
||||
fn token_text_store_strips_simple_suffix() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login with `/simple` suffix
|
||||
context
|
||||
@@ -1645,7 +1645,7 @@ fn token_text_store_strips_simple_suffix() {
|
||||
|
||||
#[test]
|
||||
fn token_text_store_username() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login with specific username
|
||||
context
|
||||
@@ -1745,7 +1745,7 @@ fn token_text_store_username() {
|
||||
|
||||
#[test]
|
||||
fn logout_text_store_multiple_usernames() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Login with two different usernames for the same service
|
||||
context
|
||||
@@ -1825,7 +1825,7 @@ fn logout_text_store_multiple_usernames() {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn native_auth_prefix_match() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -1875,7 +1875,7 @@ fn native_auth_prefix_match() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "native-auth")]
|
||||
fn native_auth_host_fallback() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]).with_real_home();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_real_home();
|
||||
|
||||
// Clear state before the test
|
||||
context
|
||||
@@ -1939,7 +1939,7 @@ fn native_auth_host_fallback() -> Result<()> {
|
||||
/// Test credential helper with basic auth credentials
|
||||
#[test]
|
||||
fn bazel_helper_basic_auth() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Store credentials
|
||||
uv_snapshot!(context.filters(), context.auth_login()
|
||||
@@ -1973,7 +1973,7 @@ fn bazel_helper_basic_auth() {
|
||||
/// Test credential helper with token credentials
|
||||
#[test]
|
||||
fn bazel_helper_token() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Store token
|
||||
uv_snapshot!(context.filters(), context.auth_login()
|
||||
@@ -2007,7 +2007,7 @@ fn bazel_helper_token() {
|
||||
/// Test credential helper with no credentials found
|
||||
#[test]
|
||||
fn bazel_helper_no_credentials() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
uv_snapshot!(context.filters(), context.auth_helper()
|
||||
.arg("--protocol=bazel")
|
||||
.arg("get"),
|
||||
@@ -2027,7 +2027,7 @@ fn bazel_helper_no_credentials() {
|
||||
/// Test credential helper with invalid JSON input
|
||||
#[test]
|
||||
fn bazel_helper_invalid_json() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.auth_helper()
|
||||
.arg("--protocol=bazel")
|
||||
@@ -2049,7 +2049,7 @@ fn bazel_helper_invalid_json() {
|
||||
/// Test credential helper with invalid URI
|
||||
#[test]
|
||||
fn bazel_helper_invalid_uri() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.auth_helper()
|
||||
.arg("--protocol=bazel")
|
||||
@@ -2071,7 +2071,7 @@ fn bazel_helper_invalid_uri() {
|
||||
/// Test credential helper with username in URI
|
||||
#[test]
|
||||
fn bazel_helper_username_in_uri() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Store credentials with specific username
|
||||
uv_snapshot!(context.filters(), context.auth_login()
|
||||
@@ -2106,7 +2106,7 @@ fn bazel_helper_username_in_uri() {
|
||||
/// Test credential helper with unknown username in URI
|
||||
#[test]
|
||||
fn bazel_helper_unknown_username_in_uri() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Store credentials with specific username
|
||||
uv_snapshot!(context.filters(), context.auth_login()
|
||||
@@ -2144,7 +2144,7 @@ fn bazel_helper_unknown_username_in_uri() {
|
||||
/// `pyx.dev` should still be recognized as a pyx domain and use the OAuth flow.
|
||||
#[test]
|
||||
fn login_pyx_dev_with_custom_api_url() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// When PYX_API_URL is set to localhost, `pyx.dev` should still be recognized as pyx
|
||||
// and reject username/password (because pyx uses OAuth, not basic auth).
|
||||
@@ -2203,7 +2203,7 @@ fn login_pyx_dev_with_custom_api_url() {
|
||||
/// Test that logout recognizes `pyx.dev` even with custom `PYX_API_URL`.
|
||||
#[test]
|
||||
fn logout_pyx_dev_with_custom_api_url() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Logout for pyx.dev should use the pyx flow (succeeds with no-op message because
|
||||
// no credentials exist, but verifies it's recognized as pyx).
|
||||
@@ -2223,7 +2223,7 @@ fn logout_pyx_dev_with_custom_api_url() {
|
||||
/// Test that `uv auth token` recognizes `pyx.dev` even with custom `PYX_API_URL`.
|
||||
#[test]
|
||||
fn token_pyx_dev_with_custom_api_url() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Token for pyx.dev should use the pyx flow and reject username.
|
||||
uv_snapshot!(context.auth_token()
|
||||
@@ -2247,7 +2247,7 @@ fn token_pyx_dev_with_custom_api_url() {
|
||||
/// treated as pyx domains - users must set `PYX_API_URL` to use non-default pyx environments.
|
||||
#[test]
|
||||
fn token_pyx_staging_without_env_var() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Without PYX_API_URL set, staging pyx URLs are NOT recognized as pyx domains.
|
||||
// They fall through to the normal credential store lookup.
|
||||
@@ -2266,7 +2266,7 @@ fn token_pyx_staging_without_env_var() {
|
||||
/// Test that staging pyx URLs work correctly when `PYX_API_URL` is set.
|
||||
#[test]
|
||||
fn login_pyx_staging_with_env_var() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// When PYX_API_URL is set to a staging URL, that URL is recognized as pyx
|
||||
// and rejects username/password.
|
||||
|
||||
@@ -2,7 +2,7 @@ use anyhow::Result;
|
||||
use indoc::indoc;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
use crate::common::{TestContext, make_project, uv_snapshot};
|
||||
use uv_test::{make_project, uv_snapshot};
|
||||
|
||||
/// The root package has diverging URLs for disjoint markers:
|
||||
/// ```toml
|
||||
@@ -14,7 +14,7 @@ use crate::common::{TestContext, make_project, uv_snapshot};
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn branching_urls_disjoint() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
@@ -48,7 +48,7 @@ fn branching_urls_disjoint() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn branching_urls_overlapping() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
@@ -86,7 +86,7 @@ fn branching_urls_overlapping() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn root_package_splits_but_transitive_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
@@ -157,7 +157,7 @@ fn root_package_splits_but_transitive_conflict() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn root_package_splits_transitive_too() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
@@ -363,7 +363,7 @@ fn root_package_splits_transitive_too() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn root_package_splits_other_dependencies_too() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
@@ -547,7 +547,7 @@ fn root_package_splits_other_dependencies_too() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn branching_between_registry_and_direct_url() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
@@ -633,7 +633,7 @@ fn branching_between_registry_and_direct_url() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(all(feature = "test-git", feature = "test-pypi"))]
|
||||
fn branching_urls_of_different_sources_disjoint() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
@@ -717,7 +717,7 @@ fn branching_urls_of_different_sources_disjoint() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(all(feature = "test-git", feature = "test-pypi"))]
|
||||
fn branching_urls_of_different_sources_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
@@ -747,7 +747,7 @@ fn branching_urls_of_different_sources_conflict() -> Result<()> {
|
||||
/// Ensure that we don't pre-visit package with URLs.
|
||||
#[test]
|
||||
fn dont_pre_visit_url_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let deps = indoc! {r#"
|
||||
dependencies = [
|
||||
|
||||
+33
-33
@@ -1,4 +1,3 @@
|
||||
use crate::common::{DEFAULT_PYTHON_VERSION, TestContext, uv_snapshot};
|
||||
use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::prelude::*;
|
||||
@@ -8,11 +7,12 @@ use insta::assert_snapshot;
|
||||
use predicates::prelude::predicate;
|
||||
use std::env::current_dir;
|
||||
use uv_static::EnvVars;
|
||||
use uv_test::{DEFAULT_PYTHON_VERSION, uv_snapshot};
|
||||
use zip::ZipArchive;
|
||||
|
||||
#[test]
|
||||
fn build_basic() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -130,7 +130,7 @@ fn build_basic() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_sdist() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -186,7 +186,7 @@ fn build_sdist() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_wheel() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -242,7 +242,7 @@ fn build_wheel() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_sdist_wheel() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -300,7 +300,7 @@ fn build_sdist_wheel() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_wheel_from_sdist() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -409,7 +409,7 @@ fn build_wheel_from_sdist() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_fail() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -484,7 +484,7 @@ fn build_fail() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -689,7 +689,7 @@ fn build_workspace() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_all_with_failure() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -835,7 +835,7 @@ fn build_all_with_failure() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -896,7 +896,7 @@ fn build_constraints() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_sha() -> Result<()> {
|
||||
let context = TestContext::new(DEFAULT_PYTHON_VERSION);
|
||||
let context = uv_test::test_context!(DEFAULT_PYTHON_VERSION);
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -1100,7 +1100,7 @@ fn build_sha() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_quiet() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("project");
|
||||
|
||||
@@ -1139,7 +1139,7 @@ fn build_quiet() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_no_build_logs() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("project");
|
||||
|
||||
@@ -1183,7 +1183,7 @@ fn build_no_build_logs() -> Result<()> {
|
||||
/// Test that `UV_HIDE_BUILD_OUTPUT` suppresses build output.
|
||||
#[test]
|
||||
fn build_hide_build_output_env_var() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("project");
|
||||
|
||||
@@ -1227,7 +1227,7 @@ fn build_hide_build_output_env_var() -> Result<()> {
|
||||
/// Test that `UV_HIDE_BUILD_OUTPUT` hides build output even on failure.
|
||||
#[test]
|
||||
fn build_hide_build_output_on_failure() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -1278,7 +1278,7 @@ fn build_hide_build_output_on_failure() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_tool_uv_sources() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -1374,7 +1374,7 @@ fn build_tool_uv_sources() -> Result<()> {
|
||||
/// Check that we have a working git boundary for builds from source dist to wheel in `dist/`.
|
||||
#[test]
|
||||
fn build_git_boundary_in_dist_build() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("demo");
|
||||
project.child("pyproject.toml").write_str(
|
||||
@@ -1427,7 +1427,7 @@ fn build_git_boundary_in_dist_build() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_non_package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -1531,7 +1531,7 @@ fn build_non_package() -> Result<()> {
|
||||
/// * `--sdist --wheel`
|
||||
#[test]
|
||||
fn build_fast_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let built_by_uv = current_dir()?.join("../../test/packages/built-by-uv");
|
||||
|
||||
@@ -1631,7 +1631,7 @@ fn build_fast_path() -> Result<()> {
|
||||
/// Test the `--list` option.
|
||||
#[test]
|
||||
fn build_list_files() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let built_by_uv = current_dir()?.join("../../test/packages/built-by-uv");
|
||||
|
||||
@@ -1753,7 +1753,7 @@ fn build_list_files() -> Result<()> {
|
||||
/// Test `--list` option errors.
|
||||
#[test]
|
||||
fn build_list_files_errors() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let built_by_uv = current_dir()?.join("../../test/packages/built-by-uv");
|
||||
|
||||
@@ -1801,7 +1801,7 @@ fn build_list_files_errors() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_version_mismatch() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let anyio_local = current_dir()?.join("../../test/packages/anyio_local");
|
||||
context
|
||||
.build()
|
||||
@@ -1836,7 +1836,7 @@ fn build_version_mismatch() -> Result<()> {
|
||||
#[cfg(unix)] // Symlinks aren't universally available on windows.
|
||||
#[test]
|
||||
fn build_with_symlink() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context
|
||||
.temp_dir
|
||||
.child("pyproject.toml.real")
|
||||
@@ -1875,7 +1875,7 @@ fn build_with_symlink() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_with_hardlink() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context
|
||||
.temp_dir
|
||||
.child("pyproject.toml.real")
|
||||
@@ -1916,7 +1916,7 @@ fn build_with_hardlink() -> Result<()> {
|
||||
/// PEP 517 build system not a setup.py, so we fallback to setuptools implicitly.
|
||||
#[test]
|
||||
fn build_unconfigured_setuptools() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context
|
||||
.temp_dir
|
||||
.child("pyproject.toml")
|
||||
@@ -1959,7 +1959,7 @@ fn build_unconfigured_setuptools() -> Result<()> {
|
||||
/// in the root.
|
||||
#[test]
|
||||
fn build_workspace_virtual_root() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context
|
||||
.temp_dir
|
||||
.child("pyproject.toml")
|
||||
@@ -1987,7 +1987,7 @@ fn build_workspace_virtual_root() -> Result<()> {
|
||||
/// `setup.{py,cfg}`.
|
||||
#[test]
|
||||
fn build_pyproject_toml_not_a_project() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context
|
||||
.temp_dir
|
||||
.child("pyproject.toml")
|
||||
@@ -2014,7 +2014,7 @@ fn build_pyproject_toml_not_a_project() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_with_nonnormalized_name() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let filters = context
|
||||
.filters()
|
||||
.into_iter()
|
||||
@@ -2076,7 +2076,7 @@ fn build_with_nonnormalized_name() -> Result<()> {
|
||||
#[test]
|
||||
fn force_pep517() -> Result<()> {
|
||||
// We need to use a real `uv_build` package.
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-05-27T00:00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-05-27T00:00:00Z");
|
||||
|
||||
context.init().assert().success();
|
||||
|
||||
@@ -2131,7 +2131,7 @@ fn force_pep517() -> Result<()> {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn venv_included_in_sdist() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context
|
||||
.init()
|
||||
@@ -2186,7 +2186,7 @@ fn venv_included_in_sdist() -> Result<()> {
|
||||
/// <https://github.com/astral-sh/uv/issues/13914>
|
||||
#[test]
|
||||
fn test_workspace_trailing_slash() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a workspace with a root and a member.
|
||||
context.init().arg("--lib").assert().success();
|
||||
@@ -2246,7 +2246,7 @@ fn test_workspace_trailing_slash() {
|
||||
/// Test `uv build --clear`.
|
||||
#[test]
|
||||
fn build_clear() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("project");
|
||||
|
||||
@@ -2313,7 +2313,7 @@ fn build_clear() -> Result<()> {
|
||||
/// Test `uv build --no-create-gitignore`.
|
||||
#[test]
|
||||
fn build_no_gitignore() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("project");
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::common::{TestContext, uv_snapshot, venv_bin_path};
|
||||
use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::{FileTouch, FileWriteBin, FileWriteStr, PathChild, PathCreateDir};
|
||||
@@ -11,6 +10,7 @@ use std::path::Path;
|
||||
use std::process::Command;
|
||||
use tempfile::TempDir;
|
||||
use uv_static::EnvVars;
|
||||
use uv_test::{uv_snapshot, venv_bin_path};
|
||||
|
||||
const BUILT_BY_UV_TEST_SCRIPT: &str = indoc! {r#"
|
||||
from built_by_uv import greet
|
||||
@@ -26,7 +26,7 @@ const BUILT_BY_UV_TEST_SCRIPT: &str = indoc! {r#"
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn built_by_uv_direct_wheel() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let built_by_uv = Path::new("../../test/packages/built-by-uv");
|
||||
|
||||
let temp_dir = TempDir::new()?;
|
||||
@@ -82,7 +82,7 @@ fn built_by_uv_direct_wheel() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn built_by_uv_direct() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let built_by_uv = Path::new("../../test/packages/built-by-uv");
|
||||
|
||||
let sdist_dir = TempDir::new()?;
|
||||
@@ -156,7 +156,7 @@ fn built_by_uv_direct() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn built_by_uv_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let built_by_uv = Path::new("../../test/packages/built-by-uv");
|
||||
|
||||
// Without the editable, pytest fails.
|
||||
@@ -217,7 +217,7 @@ fn built_by_uv_editable() -> Result<()> {
|
||||
fn preserve_executable_bit() -> Result<()> {
|
||||
use std::io::Write;
|
||||
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project_dir = context.temp_dir.path().join("preserve_executable_bit");
|
||||
context
|
||||
@@ -280,7 +280,7 @@ fn preserve_executable_bit() -> Result<()> {
|
||||
/// potential modules.
|
||||
#[test]
|
||||
fn rename_module() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let temp_dir = TempDir::new()?;
|
||||
|
||||
context
|
||||
@@ -361,7 +361,7 @@ fn rename_module() -> Result<()> {
|
||||
/// Test `tool.uv.build-backend.module-name` for editable builds.
|
||||
#[test]
|
||||
fn rename_module_editable_build() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let temp_dir = TempDir::new()?;
|
||||
|
||||
context
|
||||
@@ -421,7 +421,7 @@ fn rename_module_editable_build() -> Result<()> {
|
||||
/// Check that the build succeeds even if the module name mismatches by case.
|
||||
#[test]
|
||||
fn build_module_name_normalization() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let wheel_dir = context.temp_dir.path().join("dist");
|
||||
fs_err::create_dir(&wheel_dir)?;
|
||||
@@ -535,7 +535,7 @@ fn build_module_name_normalization() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn build_sdist_with_long_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let temp_dir = TempDir::new()?;
|
||||
|
||||
context
|
||||
@@ -578,7 +578,7 @@ fn build_sdist_with_long_path() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn sdist_error_without_module() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let temp_dir = TempDir::new()?;
|
||||
|
||||
context
|
||||
@@ -625,7 +625,7 @@ fn sdist_error_without_module() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn complex_namespace_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let dist = context.temp_dir.child("dist");
|
||||
dist.create_dir_all()?;
|
||||
|
||||
@@ -762,7 +762,7 @@ fn complex_namespace_packages() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn license_glob_without_matches_errors() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("missing-license");
|
||||
context
|
||||
@@ -807,7 +807,7 @@ fn license_glob_without_matches_errors() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn license_file_must_be_utf8() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("license-utf8");
|
||||
context
|
||||
@@ -852,7 +852,7 @@ fn license_file_must_be_utf8() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn symlinked_file() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("project");
|
||||
context
|
||||
@@ -941,7 +941,7 @@ fn symlinked_file() -> Result<()> {
|
||||
/// They may be from another `uv_build` version that has a different schema.
|
||||
#[test]
|
||||
fn invalid_build_backend_settings_are_ignored() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -977,7 +977,7 @@ fn invalid_build_backend_settings_are_ignored() -> Result<()> {
|
||||
/// `tool.uv.build-backend.module-root = ".."`.
|
||||
#[test]
|
||||
fn error_on_relative_module_root_outside_project_root() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -1025,7 +1025,7 @@ fn error_on_relative_module_root_outside_project_root() -> Result<()> {
|
||||
/// `tool.uv.build-backend.data.headers = "../headers"`.
|
||||
#[test]
|
||||
fn error_on_relative_data_dir_outside_project_root() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let project = context.temp_dir.child("project");
|
||||
project.create_dir_all()?;
|
||||
@@ -1079,7 +1079,7 @@ fn error_on_relative_data_dir_outside_project_root() -> Result<()> {
|
||||
/// Show an explicit error when there is a venv in source tree.
|
||||
#[test]
|
||||
fn venv_in_source_tree() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context
|
||||
.init()
|
||||
@@ -1121,7 +1121,7 @@ fn venv_in_source_tree() {
|
||||
/// Show a warning when the build backend is passed redundant module names
|
||||
#[test]
|
||||
fn warn_on_redundant_module_names() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -1188,7 +1188,7 @@ fn warn_on_redundant_module_names() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn invalid_pyproject_toml() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context
|
||||
.temp_dir
|
||||
@@ -1226,7 +1226,7 @@ fn invalid_pyproject_toml() -> Result<()> {
|
||||
#[cfg(feature = "test-pypi")]
|
||||
#[test]
|
||||
fn build_with_all_metadata() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let temp_dir = TempDir::new()?;
|
||||
|
||||
context
|
||||
|
||||
@@ -6,16 +6,16 @@ use assert_fs::prelude::*;
|
||||
use std::process::Command;
|
||||
|
||||
#[cfg(unix)]
|
||||
use crate::common::{TestContext, get_bin, uv_snapshot};
|
||||
use uv_test::{get_bin, uv_snapshot};
|
||||
|
||||
/// When the cache directory cannot be created (e.g., due to permissions), we should show a
|
||||
/// chained error message that indicates we failed to initialize the cache.
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn cache_init_failure() -> Result<()> {
|
||||
use crate::common::ReadOnlyDirectoryGuard;
|
||||
use uv_test::ReadOnlyDirectoryGuard;
|
||||
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -47,7 +47,7 @@ fn cache_init_failure() -> Result<()> {
|
||||
|
||||
// Build the sync command manually to use our custom cache directory.
|
||||
// We can't use context.sync() because it adds --cache-dir with the default cache.
|
||||
let mut command = Command::new(get_bin());
|
||||
let mut command = Command::new(get_bin!());
|
||||
command
|
||||
.arg("sync")
|
||||
.arg("--cache-dir")
|
||||
|
||||
@@ -5,12 +5,12 @@ use assert_fs::prelude::*;
|
||||
use uv_cache::Cache;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
/// `cache clean` should remove all packages.
|
||||
#[test]
|
||||
fn clean_all() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("typing-extensions\niniconfig")?;
|
||||
@@ -40,7 +40,7 @@ fn clean_all() -> Result<()> {
|
||||
|
||||
#[tokio::test]
|
||||
async fn clean_force() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("typing-extensions\niniconfig")?;
|
||||
@@ -96,7 +96,7 @@ async fn clean_force() -> Result<()> {
|
||||
/// `cache clean iniconfig` should remove a single package (`iniconfig`).
|
||||
#[test]
|
||||
fn clean_package_pypi() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio\niniconfig")?;
|
||||
@@ -172,7 +172,7 @@ fn clean_package_pypi() -> Result<()> {
|
||||
/// `cache clean iniconfig` should remove a single package (`iniconfig`).
|
||||
#[test]
|
||||
fn clean_package_index() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio\niniconfig")?;
|
||||
@@ -236,7 +236,7 @@ fn clean_package_index() -> Result<()> {
|
||||
|
||||
#[tokio::test]
|
||||
async fn cache_timeout() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Simulate another uv process running and locking the cache, e.g., with a source build.
|
||||
let _cache = Cache::from_path(context.cache_dir.path())
|
||||
|
||||
@@ -5,13 +5,12 @@ use indoc::indoc;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::TestContext;
|
||||
use crate::common::uv_snapshot;
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
/// `cache prune` should be a no-op if there's nothing out-of-date in the cache.
|
||||
#[test]
|
||||
fn prune_no_op() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio")?;
|
||||
@@ -48,7 +47,7 @@ fn prune_no_op() -> Result<()> {
|
||||
/// `cache prune` should remove any stale top-level directories from the cache.
|
||||
#[test]
|
||||
fn prune_stale_directory() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio")?;
|
||||
@@ -90,7 +89,7 @@ fn prune_stale_directory() -> Result<()> {
|
||||
/// `cache prune` should remove all cached environments from the cache.
|
||||
#[test]
|
||||
fn prune_cached_env() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -151,7 +150,7 @@ fn prune_cached_env() {
|
||||
/// `cache prune` should remove any stale symlink from the cache.
|
||||
#[test]
|
||||
fn prune_stale_symlink() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio")?;
|
||||
@@ -198,7 +197,7 @@ fn prune_stale_symlink() -> Result<()> {
|
||||
|
||||
#[tokio::test]
|
||||
async fn prune_force() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("typing-extensions\niniconfig")?;
|
||||
@@ -252,7 +251,7 @@ async fn prune_force() -> Result<()> {
|
||||
/// `cache prune --ci` should remove all unzipped archives.
|
||||
#[test]
|
||||
fn prune_unzipped() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-01-01T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-01-01T00:00Z");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(indoc! { r"
|
||||
@@ -331,7 +330,7 @@ fn prune_unzipped() -> Result<()> {
|
||||
/// `cache prune` should remove any stale source distribution revisions.
|
||||
#[test]
|
||||
fn prune_stale_revision() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
/// Test that `cache size` returns 0 for an empty cache directory (raw output).
|
||||
#[test]
|
||||
fn cache_size_empty_raw() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Clean cache first to ensure truly empty state
|
||||
context.clean().assert().success();
|
||||
@@ -23,7 +23,7 @@ fn cache_size_empty_raw() {
|
||||
/// Test that `cache size` returns raw bytes after installing packages.
|
||||
#[test]
|
||||
fn cache_size_with_packages_raw() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install a requirement to populate the cache.
|
||||
context.pip_install().arg("iniconfig").assert().success();
|
||||
@@ -42,7 +42,7 @@ fn cache_size_with_packages_raw() {
|
||||
/// Test that `cache size --human` returns human-readable format after installing packages.
|
||||
#[test]
|
||||
fn cache_size_with_packages_human() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install a requirement to populate the cache.
|
||||
context.pip_install().arg("iniconfig").assert().success();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::common::{self, TestContext, get_bin};
|
||||
use anyhow::Result;
|
||||
use insta::assert_snapshot;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use uv_static::EnvVars;
|
||||
use uv_test::get_bin;
|
||||
|
||||
// These tests just run `uv lock` on an assorted of ecosystem
|
||||
// projects.
|
||||
@@ -83,7 +83,7 @@ fn airflow() -> Result<()> {
|
||||
/// is, there should be a directory at `./test/ecosystem/{name}` from the
|
||||
/// root of the `uv` repository.
|
||||
fn lock_ecosystem_package(python_version: &str, name: &str) -> Result<()> {
|
||||
let context = TestContext::new(python_version);
|
||||
let context = uv_test::test_context!(python_version);
|
||||
context.copy_ecosystem_project(name);
|
||||
|
||||
// Cache source distribution builds to speed up the tests.
|
||||
@@ -91,16 +91,16 @@ fn lock_ecosystem_package(python_version: &str, name: &str) -> Result<()> {
|
||||
std::path::absolute(Path::new("../../target/ecosystem-test-caches").join(name))?;
|
||||
|
||||
// Custom command since we need to change the cache dir.
|
||||
let mut command = Command::new(get_bin());
|
||||
let mut command = Command::new(get_bin!());
|
||||
context.add_shared_env(&mut command, false);
|
||||
command.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER);
|
||||
command.arg("lock").arg("--cache-dir").arg(&cache_dir);
|
||||
|
||||
let (snapshot, _) = common::run_and_format(
|
||||
let (snapshot, _) = uv_test::run_and_format(
|
||||
&mut command,
|
||||
context.filters(),
|
||||
name,
|
||||
Some(common::WindowsFilters::Platform),
|
||||
Some(uv_test::WindowsFilters::Platform),
|
||||
None,
|
||||
);
|
||||
|
||||
|
||||
+178
-178
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,5 @@
|
||||
#![allow(clippy::disallowed_types)]
|
||||
|
||||
#[cfg(feature = "test-git")]
|
||||
use crate::common::{READ_ONLY_GITHUB_SSH_DEPLOY_KEY, READ_ONLY_GITHUB_TOKEN, decode_token};
|
||||
use crate::common::{TestContext, apply_filters, copy_dir_ignore, uv_snapshot};
|
||||
use anyhow::{Ok, Result};
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::prelude::*;
|
||||
@@ -14,10 +11,13 @@ use std::process::Stdio;
|
||||
#[cfg(feature = "test-git")]
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
#[cfg(feature = "test-git")]
|
||||
use uv_test::{READ_ONLY_GITHUB_SSH_DEPLOY_KEY, READ_ONLY_GITHUB_TOKEN, decode_token};
|
||||
use uv_test::{apply_filters, copy_dir_ignore, uv_snapshot};
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_dependency() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -65,7 +65,7 @@ fn requirements_txt_dependency() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_export_no_header() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -111,7 +111,7 @@ fn requirements_txt_export_no_header() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_dependency_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -194,7 +194,7 @@ fn requirements_txt_dependency_extra() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_project_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -346,7 +346,7 @@ fn requirements_txt_project_extra() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_prune() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -411,7 +411,7 @@ fn requirements_txt_prune() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_dependency_marker() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -463,7 +463,7 @@ fn requirements_txt_dependency_marker() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_dependency_multiple_markers() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -546,7 +546,7 @@ fn requirements_txt_dependency_multiple_markers() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_dependency_conflicting_markers() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -790,7 +790,7 @@ fn requirements_txt_dependency_conflicting_markers() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_non_root() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -851,7 +851,7 @@ fn requirements_txt_non_root() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn allrequirements_txt_() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -926,7 +926,7 @@ fn allrequirements_txt_() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_frozen() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1014,7 +1014,7 @@ fn requirements_txt_frozen() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_create_missing_dir() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1092,7 +1092,7 @@ fn requirements_txt_create_missing_dir() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_non_project() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1148,7 +1148,7 @@ fn requirements_txt_non_project() -> Result<()> {
|
||||
#[test]
|
||||
fn virtual_empty() -> Result<()> {
|
||||
// testing how `uv export` reacts to a pyproject with no `[project]` and nothing useful to it
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -1175,7 +1175,7 @@ fn virtual_empty() -> Result<()> {
|
||||
fn virtual_dependency_group() -> Result<()> {
|
||||
// testing basic `uv export --group` functionality
|
||||
// when the pyproject.toml is fully virtual (no `[project]`)
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -1244,7 +1244,7 @@ fn virtual_dependency_group() -> Result<()> {
|
||||
#[cfg(feature = "test-git")]
|
||||
#[test]
|
||||
fn requirements_txt_https_git_credentials() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let token = decode_token(READ_ONLY_GITHUB_TOKEN);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
@@ -1309,7 +1309,7 @@ fn reduce_ssh_key_file_permissions(key_file: &Path) -> Result<()> {
|
||||
#[cfg(feature = "test-git")]
|
||||
#[test]
|
||||
fn requirements_txt_ssh_git_username() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1397,7 +1397,7 @@ fn requirements_txt_ssh_git_username() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_https_credentials() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(&formatdoc! {r#"
|
||||
@@ -1430,7 +1430,7 @@ fn requirements_txt_https_credentials() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_non_project_marker() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1485,7 +1485,7 @@ fn requirements_txt_non_project_marker() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_non_project_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1563,7 +1563,7 @@ fn requirements_txt_non_project_workspace() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_non_project_fork() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1789,7 +1789,7 @@ fn requirements_txt_non_project_fork() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_relative_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let dependency = context.temp_dir.child("dependency");
|
||||
dependency.child("pyproject.toml").write_str(
|
||||
@@ -1877,7 +1877,7 @@ fn requirements_txt_relative_path() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn devrequirements_txt_() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1972,7 +1972,7 @@ fn devrequirements_txt_() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_no_hashes() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2014,7 +2014,7 @@ fn requirements_txt_no_hashes() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_output_file() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2081,7 +2081,7 @@ fn requirements_txt_output_file() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_no_emit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2267,7 +2267,7 @@ fn requirements_txt_no_emit() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_only_emit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2353,7 +2353,7 @@ fn requirements_txt_only_emit() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_no_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2428,7 +2428,7 @@ fn requirements_txt_no_editable() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_export_group() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2605,7 +2605,7 @@ fn requirements_txt_export_group() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_script() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let script = context.temp_dir.child("script.py");
|
||||
script.write_str(indoc! {r#"
|
||||
@@ -2868,7 +2868,7 @@ fn requirements_txt_script() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_conflicts() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2970,7 +2970,7 @@ fn requirements_txt_conflicts() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_simple_conflict_markers() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3055,7 +3055,7 @@ fn requirements_txt_simple_conflict_markers() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn requirements_txt_complex_conflict_markers() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-01-30T00:00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-01-30T00:00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3430,7 +3430,7 @@ fn requirements_txt_complex_conflict_markers() -> Result<()> {
|
||||
/// Export requirements in the presence of a cycle.
|
||||
#[test]
|
||||
fn requirements_txt_cyclic_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3516,7 +3516,7 @@ fn requirements_txt_cyclic_dependencies() -> Result<()> {
|
||||
/// Export requirements in the presence of a cycle, with conflicts enabled.
|
||||
#[test]
|
||||
fn requirements_txt_cyclic_dependencies_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3615,7 +3615,7 @@ fn requirements_txt_cyclic_dependencies_conflict() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_dependency() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3678,7 +3678,7 @@ fn pep_751_dependency() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_export_no_header() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3739,7 +3739,7 @@ fn pep_751_export_no_header() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_export_no_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3802,7 +3802,7 @@ fn pep_751_export_no_editable() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_dependency_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3919,7 +3919,7 @@ fn pep_751_dependency_extra() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_project_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4150,7 +4150,7 @@ fn pep_751_project_extra() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn pep_751_git_dependency() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4192,7 +4192,7 @@ fn pep_751_git_dependency() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_wheel_url() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4245,7 +4245,7 @@ fn pep_751_wheel_url() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_sdist_url() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4298,7 +4298,7 @@ fn pep_751_sdist_url() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_sdist_url_subdirectory() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4361,7 +4361,7 @@ fn pep_751_sdist_url_subdirectory() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_infer_output_format() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4497,7 +4497,7 @@ fn pep_751_infer_output_format() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_filename() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4532,7 +4532,7 @@ fn pep_751_filename() -> Result<()> {
|
||||
#[cfg(feature = "test-git")]
|
||||
#[test]
|
||||
fn pep_751_https_git_credentials() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let token = decode_token(READ_ONLY_GITHUB_TOKEN);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
@@ -4571,7 +4571,7 @@ fn pep_751_https_git_credentials() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn pep_751_https_credentials() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(&formatdoc! {r#"
|
||||
@@ -4612,7 +4612,7 @@ fn pep_751_https_credentials() -> Result<()> {
|
||||
/// <https://github.com/astral-sh/uv/issues/15103>
|
||||
#[test]
|
||||
fn no_editable_env_var() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context
|
||||
.init()
|
||||
@@ -4640,7 +4640,7 @@ fn no_editable_env_var() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn export_only_group_and_extra_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4693,7 +4693,7 @@ fn export_only_group_and_extra_conflict() -> Result<()> {
|
||||
/// The members in the workspace (`foo`) and in the lockfile (`bar`) mismatch.
|
||||
#[test]
|
||||
fn export_lock_workspace_mismatch_with_frozen() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4735,7 +4735,7 @@ fn export_lock_workspace_mismatch_with_frozen() -> Result<()> {
|
||||
/// Export multiple packages within a workspace.
|
||||
#[test]
|
||||
fn multiple_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4878,7 +4878,7 @@ fn multiple_packages() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_basic() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -4959,7 +4959,7 @@ fn cyclonedx_export_basic() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_direct_url() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5042,7 +5042,7 @@ fn cyclonedx_export_direct_url() -> Result<()> {
|
||||
#[cfg(feature = "test-git")]
|
||||
#[test]
|
||||
fn cyclonedx_export_git_dependency() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5124,7 +5124,7 @@ fn cyclonedx_export_git_dependency() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_no_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5193,7 +5193,7 @@ fn cyclonedx_export_no_dependencies() -> Result<()> {
|
||||
#[cfg(feature = "test-git")]
|
||||
#[test]
|
||||
fn cyclonedx_export_mixed_source_types() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5303,7 +5303,7 @@ fn cyclonedx_export_mixed_source_types() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_project_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5389,7 +5389,7 @@ fn cyclonedx_export_project_extra() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_project_extra_with_optional_flag() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5499,7 +5499,7 @@ fn cyclonedx_export_project_extra_with_optional_flag() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_with_workspace_member() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5665,7 +5665,7 @@ fn cyclonedx_export_with_workspace_member() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_workspace_non_root() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5768,7 +5768,7 @@ fn cyclonedx_export_workspace_non_root() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_workspace_with_extras() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5993,7 +5993,7 @@ fn cyclonedx_export_workspace_with_extras() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_workspace_frozen() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -6157,7 +6157,7 @@ fn cyclonedx_export_workspace_frozen() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_workspace_all_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -6349,7 +6349,7 @@ fn cyclonedx_export_workspace_all_packages() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_all_packages_non_workspace_root_dependency() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -6449,7 +6449,7 @@ fn cyclonedx_export_all_packages_non_workspace_root_dependency() -> Result<()> {
|
||||
// Contains a combination of combination of workspace and registry deps, with another workspace dep not depended on by the root
|
||||
#[test]
|
||||
fn cyclonedx_export_workspace_mixed_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -6630,7 +6630,7 @@ fn cyclonedx_export_workspace_mixed_dependencies() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_dependency_marker() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -6733,7 +6733,7 @@ fn cyclonedx_export_dependency_marker() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_multiple_dependency_markers() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -6862,7 +6862,7 @@ fn cyclonedx_export_multiple_dependency_markers() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_dependency_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -6994,7 +6994,7 @@ fn cyclonedx_export_dependency_extra() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_prune() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -7182,7 +7182,7 @@ fn cyclonedx_export_prune() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_group() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -7420,7 +7420,7 @@ fn cyclonedx_export_group() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_non_project() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -7542,7 +7542,7 @@ fn cyclonedx_export_non_project() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_no_emit() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -7746,7 +7746,7 @@ fn cyclonedx_export_no_emit() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_relative_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let dependency = context.temp_dir.child("dependency");
|
||||
dependency.child("pyproject.toml").write_str(
|
||||
@@ -7859,7 +7859,7 @@ fn cyclonedx_export_relative_path() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_cyclic_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -8058,7 +8058,7 @@ fn cyclonedx_export_cyclic_dependencies() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_dev_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -8271,7 +8271,7 @@ fn cyclonedx_export_dev_dependencies() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_all_packages_conflicting_workspace_members() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -8424,7 +8424,7 @@ fn cyclonedx_export_all_packages_conflicting_workspace_members() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_alternative_registry() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_cyclonedx_filters()
|
||||
.with_exclude_newer("2025-01-30T00:00:00Z");
|
||||
|
||||
@@ -8656,7 +8656,7 @@ fn cyclonedx_export_alternative_registry() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cyclonedx_export_virtual_workspace_fixture() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_cyclonedx_filters();
|
||||
let context = uv_test::test_context!("3.12").with_cyclonedx_filters();
|
||||
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
copy_dir_ignore(
|
||||
|
||||
@@ -3,11 +3,11 @@ use assert_fs::prelude::*;
|
||||
use indoc::indoc;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn format_project() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -43,7 +43,7 @@ fn format_project() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_missing_pyproject_toml() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Create an unformatted Python file
|
||||
let main_py = context.temp_dir.child("main.py");
|
||||
@@ -70,7 +70,7 @@ fn format_missing_pyproject_toml() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_missing_project_in_pyproject_toml() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// Create an empty pyproject.toml with no [project] section
|
||||
context.temp_dir.child("pyproject.toml");
|
||||
@@ -100,7 +100,7 @@ fn format_missing_project_in_pyproject_toml() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_unmanaged_project() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -139,7 +139,7 @@ fn format_unmanaged_project() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_from_project_root() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -179,7 +179,7 @@ fn format_from_project_root() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_no_project() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let main_py = context.temp_dir.child("main.py");
|
||||
main_py.write_str(indoc! {r"
|
||||
@@ -205,7 +205,7 @@ fn format_no_project() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_relative_project() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("project").child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -251,7 +251,7 @@ fn format_relative_project() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_fails_malformed_pyproject() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str("malformed pyproject.toml")?;
|
||||
@@ -293,7 +293,7 @@ fn format_fails_malformed_pyproject() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_check() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -330,7 +330,7 @@ fn format_check() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_diff() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -372,7 +372,7 @@ fn format_diff() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_with_ruff_args() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -413,7 +413,7 @@ fn format_with_ruff_args() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_specific_files() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -457,7 +457,7 @@ fn format_specific_files() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn format_version_option() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
|
||||
+14
-14
@@ -1,10 +1,10 @@
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn help() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// The `uv help` command should show the long help message
|
||||
uv_snapshot!(context.filters(), context.help(), @r#"
|
||||
@@ -86,7 +86,7 @@ fn help() {
|
||||
|
||||
#[test]
|
||||
fn help_flag() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.command().arg("--help"), @r#"
|
||||
success: true
|
||||
@@ -165,7 +165,7 @@ fn help_flag() {
|
||||
|
||||
#[test]
|
||||
fn help_short_flag() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.command().arg("-h"), @r#"
|
||||
success: true
|
||||
@@ -244,7 +244,7 @@ fn help_short_flag() {
|
||||
|
||||
#[test]
|
||||
fn help_subcommand() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.help().arg("python"), @r#"
|
||||
success: true
|
||||
@@ -458,7 +458,7 @@ fn help_subcommand() {
|
||||
|
||||
#[test]
|
||||
fn help_subsubcommand() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.help().env_remove(EnvVars::UV_PYTHON_INSTALL_DIR).arg("python").arg("install"), @r#"
|
||||
success: true
|
||||
@@ -742,7 +742,7 @@ fn help_subsubcommand() {
|
||||
|
||||
#[test]
|
||||
fn help_flag_subcommand() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.command().arg("python").arg("--help"), @r#"
|
||||
success: true
|
||||
@@ -807,7 +807,7 @@ fn help_flag_subcommand() {
|
||||
|
||||
#[test]
|
||||
fn help_flag_subsubcommand() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.command().arg("python").arg("install").arg("--help"), @r#"
|
||||
success: true
|
||||
@@ -888,7 +888,7 @@ fn help_flag_subsubcommand() {
|
||||
|
||||
#[test]
|
||||
fn help_unknown_subcommand() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.help().arg("foobar"), @"
|
||||
success: false
|
||||
@@ -951,7 +951,7 @@ fn help_unknown_subcommand() {
|
||||
|
||||
#[test]
|
||||
fn help_unknown_subsubcommand() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.help().arg("python").arg("foobar"), @"
|
||||
success: false
|
||||
@@ -973,7 +973,7 @@ fn help_unknown_subsubcommand() {
|
||||
|
||||
#[test]
|
||||
fn help_with_global_option() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.help().arg("--no-cache"), @r#"
|
||||
success: true
|
||||
@@ -1054,7 +1054,7 @@ fn help_with_global_option() {
|
||||
|
||||
#[test]
|
||||
fn help_with_help() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.help().arg("--help"), @"
|
||||
success: true
|
||||
@@ -1073,7 +1073,7 @@ fn help_with_help() {
|
||||
|
||||
#[test]
|
||||
fn help_with_version() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.help().arg("--version"), @"
|
||||
success: false
|
||||
@@ -1093,7 +1093,7 @@ fn help_with_version() {
|
||||
|
||||
#[test]
|
||||
fn help_with_no_pager() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
// We can't really test whether the --no-pager option works with a snapshot test.
|
||||
// It's still nice to have a test for the option to confirm the option exists.
|
||||
|
||||
+75
-75
@@ -9,11 +9,11 @@ use predicates::prelude::predicate;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::{TestContext, uv_snapshot};
|
||||
|
||||
#[test]
|
||||
fn init() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo"), @"
|
||||
success: true
|
||||
@@ -66,7 +66,7 @@ fn init() {
|
||||
|
||||
#[test]
|
||||
fn init_bare() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--bare"), @"
|
||||
success: true
|
||||
@@ -114,7 +114,7 @@ fn init_bare() {
|
||||
/// Run `uv init --app` to create an application project
|
||||
#[test]
|
||||
fn init_application() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -184,7 +184,7 @@ fn init_application() -> Result<()> {
|
||||
/// When `main.py` already exists, we don't create it again
|
||||
#[test]
|
||||
fn init_application_hello_exists() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -234,7 +234,7 @@ fn init_application_hello_exists() -> Result<()> {
|
||||
/// When other Python files already exists, we still create `main.py`
|
||||
#[test]
|
||||
fn init_application_other_python_exists() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -292,7 +292,7 @@ fn init_application_other_python_exists() -> Result<()> {
|
||||
/// Run `uv init --app --package` to create a packaged application project
|
||||
#[test]
|
||||
fn init_application_package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -367,7 +367,7 @@ fn init_application_package() -> Result<()> {
|
||||
/// Run `uv init --lib` to create an library project
|
||||
#[test]
|
||||
fn init_library() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -450,7 +450,7 @@ fn init_library() -> Result<()> {
|
||||
/// init lib test once the uv build backend becomes the stable default.
|
||||
#[test]
|
||||
fn init_package_preview() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -493,7 +493,7 @@ fn init_package_preview() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_bare_lib() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--bare").arg("--lib"), @"
|
||||
success: true
|
||||
@@ -545,7 +545,7 @@ fn init_bare_lib() {
|
||||
|
||||
#[test]
|
||||
fn init_bare_package() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--bare").arg("--package"), @"
|
||||
success: true
|
||||
@@ -597,7 +597,7 @@ fn init_bare_package() {
|
||||
|
||||
#[test]
|
||||
fn init_bare_opt_in() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// With `--bare`, you can still opt-in to extras
|
||||
// TODO(zanieb): Add option for `--readme`
|
||||
@@ -650,7 +650,7 @@ fn init_bare_opt_in() {
|
||||
// General init --script correctness test
|
||||
#[test]
|
||||
fn init_script() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -703,7 +703,7 @@ fn init_script() -> Result<()> {
|
||||
/// Using `--bare` with `--script` omits the default script content.
|
||||
#[test]
|
||||
fn init_script_bare() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -739,7 +739,7 @@ fn init_script_bare() -> Result<()> {
|
||||
// Ensure python versions passed as arguments are present in file metadata
|
||||
#[test]
|
||||
fn init_script_python_version() -> Result<()> {
|
||||
let context = TestContext::new("3.11");
|
||||
let context = uv_test::test_context!("3.11");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -783,7 +783,7 @@ fn init_script_python_version() -> Result<()> {
|
||||
// Init script should create parent directories if they don't exist
|
||||
#[test]
|
||||
fn init_script_create_directory() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -827,7 +827,7 @@ fn init_script_create_directory() -> Result<()> {
|
||||
// Init script should fail if file is already a PEP 723 script
|
||||
#[test]
|
||||
fn init_script_file_conflicts() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -881,7 +881,7 @@ fn init_script_file_conflicts() -> Result<()> {
|
||||
// Init script should not trash an existing shebang.
|
||||
#[test]
|
||||
fn init_script_shebang() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let script_path = context.temp_dir.child("script.py");
|
||||
|
||||
@@ -945,8 +945,8 @@ fn init_script_picks_latest_stable_version() -> Result<()> {
|
||||
let managed_versions = &["3.14.0rc2", "3.13", "3.12"];
|
||||
// If we do not mark these versions as managed, they would have `PythonSource::SearchPath(First)`, which
|
||||
// would mean that pre-releases would be preferred without opt-in (see `PythonSource::allows_prereleases`).
|
||||
let context =
|
||||
TestContext::new_with_versions(managed_versions).with_versions_as_managed(managed_versions);
|
||||
let context = uv_test::test_context_with_versions!(managed_versions)
|
||||
.with_versions_as_managed(managed_versions);
|
||||
|
||||
let script_path = context.temp_dir.join("main.py");
|
||||
|
||||
@@ -983,7 +983,7 @@ fn init_script_picks_latest_stable_version() -> Result<()> {
|
||||
/// Run `uv init --lib` with an existing py.typed file
|
||||
#[test]
|
||||
fn init_py_typed_exists() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -1017,7 +1017,7 @@ fn init_py_typed_exists() -> Result<()> {
|
||||
/// Using `uv init --lib --no-package` isn't allowed
|
||||
#[test]
|
||||
fn init_library_no_package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -1041,7 +1041,7 @@ fn init_library_no_package() -> Result<()> {
|
||||
/// Ensure that `uv init` initializes the cache.
|
||||
#[test]
|
||||
fn init_cache() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
fs_err::remove_dir_all(&context.cache_dir)?;
|
||||
|
||||
@@ -1059,7 +1059,7 @@ fn init_cache() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_no_readme() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--no-readme"), @"
|
||||
success: true
|
||||
@@ -1091,7 +1091,7 @@ fn init_no_readme() {
|
||||
|
||||
#[test]
|
||||
fn init_no_pin_python() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--no-pin-python"), @"
|
||||
success: true
|
||||
@@ -1124,7 +1124,7 @@ fn init_no_pin_python() {
|
||||
|
||||
#[test]
|
||||
fn init_library_current_dir() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let dir = context.temp_dir.join("foo");
|
||||
fs_err::create_dir(&dir)?;
|
||||
@@ -1189,7 +1189,7 @@ fn init_library_current_dir() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_application_current_dir() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let dir = context.temp_dir.join("foo");
|
||||
fs_err::create_dir(&dir)?;
|
||||
@@ -1253,7 +1253,7 @@ fn init_application_current_dir() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_dot_args() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let dir = context.temp_dir.join("foo");
|
||||
fs_err::create_dir(&dir)?;
|
||||
@@ -1318,7 +1318,7 @@ fn init_dot_args() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -1504,7 +1504,7 @@ fn init_workspace() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_workspace_relative_sub_package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -1600,7 +1600,7 @@ fn init_workspace_relative_sub_package() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_workspace_outside() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -1697,7 +1697,7 @@ fn init_workspace_outside() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_normalized_names() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// `foo-bar` module is normalized to `foo-bar`.
|
||||
uv_snapshot!(context.filters(), context.init().current_dir(&context.temp_dir).arg("foo-bar").arg("--lib"), @"
|
||||
@@ -1796,7 +1796,7 @@ fn init_normalized_names() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_isolated() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -1847,7 +1847,7 @@ fn init_isolated() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_no_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -1922,7 +1922,7 @@ fn init_no_workspace() -> Result<()> {
|
||||
/// Warn if the user provides `--no-workspace` outside of a workspace.
|
||||
#[test]
|
||||
fn init_no_workspace_warning() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().current_dir(&context.temp_dir).arg("--no-workspace").arg("--name").arg("project"), @"
|
||||
success: true
|
||||
@@ -1954,7 +1954,7 @@ fn init_no_workspace_warning() {
|
||||
|
||||
#[test]
|
||||
fn init_project_inside_project() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2032,7 +2032,7 @@ fn init_project_inside_project() -> Result<()> {
|
||||
/// Run `uv init` from within a workspace with an explicit root.
|
||||
#[test]
|
||||
fn init_explicit_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2083,7 +2083,7 @@ fn init_explicit_workspace() -> Result<()> {
|
||||
/// Run `uv init --virtual` to create a virtual project.
|
||||
#[test]
|
||||
fn init_virtual_project() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -2154,7 +2154,7 @@ fn init_virtual_project() -> Result<()> {
|
||||
/// Run `uv init` from within a virtual workspace.
|
||||
#[test]
|
||||
fn init_virtual_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -2198,7 +2198,7 @@ fn init_virtual_workspace() -> Result<()> {
|
||||
/// Run `uv init --virtual` from within a workspace.
|
||||
#[test]
|
||||
fn init_nested_virtual_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2255,7 +2255,7 @@ fn init_nested_virtual_workspace() -> Result<()> {
|
||||
/// Run `uv init` from within a workspace. The path is already included via `members`.
|
||||
#[test]
|
||||
fn init_matches_members() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2299,7 +2299,7 @@ fn init_matches_members() -> Result<()> {
|
||||
/// Run `uv init` from within a workspace. The path is excluded via `exclude`.
|
||||
#[test]
|
||||
fn init_matches_exclude() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2342,7 +2342,7 @@ fn init_matches_exclude() -> Result<()> {
|
||||
/// Run `uv init`, inheriting the `requires-python` from the workspace.
|
||||
#[test]
|
||||
fn init_requires_python_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2400,7 +2400,7 @@ fn init_requires_python_workspace() -> Result<()> {
|
||||
/// Run `uv init`, inferring the `requires-python` from the `--python` flag.
|
||||
#[test]
|
||||
fn init_requires_python_version() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2459,7 +2459,7 @@ fn init_requires_python_version() -> Result<()> {
|
||||
/// specifiers verbatim.
|
||||
#[test]
|
||||
fn init_requires_python_specifiers() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.9", "3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2517,7 +2517,7 @@ fn init_requires_python_specifiers() -> Result<()> {
|
||||
/// Run `uv init`, inferring the `requires-python` from the `.python-version` file.
|
||||
#[test]
|
||||
fn init_requires_python_version_file() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.9", "3.12"]);
|
||||
|
||||
context.temp_dir.child(".python-version").write_str("3.9")?;
|
||||
|
||||
@@ -2554,7 +2554,7 @@ fn init_requires_python_version_file() -> Result<()> {
|
||||
/// Run `uv init`, inferring the Python version from an existing `.venv`
|
||||
#[test]
|
||||
fn init_existing_environment() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.9", "3.12"]);
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -2603,7 +2603,7 @@ fn init_existing_environment() -> Result<()> {
|
||||
/// Run `uv init`, it should ignore the Python version from a parent `.venv`
|
||||
#[test]
|
||||
fn init_existing_environment_parent() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.9", "3.12"]);
|
||||
|
||||
// Create a new virtual environment in the parent directory
|
||||
uv_snapshot!(context.filters(), context.venv().current_dir(&context.temp_dir).arg("--python").arg("3.12"), @"
|
||||
@@ -2651,7 +2651,7 @@ fn init_existing_environment_parent() -> Result<()> {
|
||||
/// Run `uv init` from within an unmanaged project.
|
||||
#[test]
|
||||
fn init_unmanaged() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {
|
||||
@@ -2687,7 +2687,7 @@ fn init_unmanaged() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_hidden() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().arg(".foo"), @"
|
||||
success: false
|
||||
@@ -2701,7 +2701,7 @@ fn init_hidden() {
|
||||
|
||||
#[test]
|
||||
fn init_non_ascii_directory() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let directory = context.temp_dir.child("püthon");
|
||||
directory.create_dir_all()?;
|
||||
@@ -2724,7 +2724,7 @@ fn init_non_ascii_directory() -> Result<()> {
|
||||
/// Run `uv init` with an invalid `pyproject.toml` in a parent directory.
|
||||
#[test]
|
||||
fn init_failure() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create an empty `pyproject.toml`.
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
@@ -2771,7 +2771,7 @@ fn init_failure() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_failure_with_invalid_option_named_backend() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--backend"), @"
|
||||
success: false
|
||||
exit_code: 2
|
||||
@@ -2804,7 +2804,7 @@ fn init_failure_with_invalid_option_named_backend() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn init_git() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
|
||||
@@ -2844,7 +2844,7 @@ fn init_git() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_vcs_none() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
|
||||
@@ -2865,7 +2865,7 @@ fn init_vcs_none() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn init_inside_git_repo() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
Command::new("git")
|
||||
.arg("init")
|
||||
@@ -2901,7 +2901,7 @@ fn init_inside_git_repo() {
|
||||
|
||||
#[test]
|
||||
fn init_git_not_installed() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
|
||||
@@ -2930,7 +2930,7 @@ fn init_git_not_installed() {
|
||||
|
||||
#[test]
|
||||
fn init_with_author() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a Git repository and set the author.
|
||||
Command::new("git")
|
||||
@@ -3062,7 +3062,7 @@ fn init_with_author() {
|
||||
/// Run `uv init --app --package --build-backend flit` to create a packaged application project
|
||||
#[test]
|
||||
fn init_application_package_flit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -3136,7 +3136,7 @@ fn init_application_package_flit() -> Result<()> {
|
||||
/// Run `uv init --lib --build-backend flit` to create an library project
|
||||
#[test]
|
||||
fn init_library_flit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -3217,7 +3217,7 @@ fn init_library_flit() -> Result<()> {
|
||||
/// Run `uv init --build-backend flit` should be equivalent to `uv init --package --build-backend flit`.
|
||||
#[test]
|
||||
fn init_backend_implies_package() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.init().arg("project").arg("--build-backend").arg("flit"), @"
|
||||
success: true
|
||||
@@ -3256,7 +3256,7 @@ fn init_backend_implies_package() {
|
||||
/// Run `uv init --build-backend poetry` to create a project with poetry-core build backend
|
||||
#[test]
|
||||
fn init_library_poetry() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-04-28T00:00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-04-28T00:00:00Z");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -3338,7 +3338,7 @@ fn init_library_poetry() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-crates-io")]
|
||||
fn init_app_build_backend_maturin() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -3468,7 +3468,7 @@ fn init_app_build_backend_maturin() -> Result<()> {
|
||||
/// Run `uv init --app --package --build-backend scikit` to create a packaged application project
|
||||
#[test]
|
||||
fn init_app_build_backend_scikit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -3593,7 +3593,7 @@ fn init_app_build_backend_scikit() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-crates-io")]
|
||||
fn init_lib_build_backend_maturin() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -3720,7 +3720,7 @@ fn init_lib_build_backend_maturin() -> Result<()> {
|
||||
/// Run `uv init --lib --build-backend scikit` to create a packaged application project
|
||||
#[test]
|
||||
fn init_lib_build_backend_scikit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -3841,7 +3841,7 @@ fn init_lib_build_backend_scikit() -> Result<()> {
|
||||
/// Run `uv init --app --package --build-backend hatchling` to create a packaged application project
|
||||
#[test]
|
||||
fn init_application_package_hatchling() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -3910,7 +3910,7 @@ fn init_application_package_hatchling() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_with_description() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.join("foo");
|
||||
fs_err::create_dir_all(&child)?;
|
||||
@@ -3954,7 +3954,7 @@ fn init_with_description() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_without_description() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.join("bar");
|
||||
fs_err::create_dir_all(&child)?;
|
||||
@@ -3997,7 +3997,7 @@ fn init_without_description() -> Result<()> {
|
||||
/// Run `uv init --python 3.13t` to create a pin to a freethreaded Python.
|
||||
#[test]
|
||||
fn init_python_variant() {
|
||||
let context = TestContext::new("3.13");
|
||||
let context = uv_test::test_context!("3.13");
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--python").arg("3.13t"), @"
|
||||
success: true
|
||||
exit_code: 0
|
||||
@@ -4014,7 +4014,7 @@ fn init_python_variant() {
|
||||
/// Check how `uv init` reacts to working and broken git with different `--vcs` options.
|
||||
#[test]
|
||||
fn git_states() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// First, with working git.
|
||||
|
||||
@@ -4075,7 +4075,7 @@ fn git_states() {
|
||||
/// Using `uv init` with `--project` isn't allowed
|
||||
#[test]
|
||||
fn init_project_flag_is_not_allowed_under_preview() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("foo");
|
||||
child.create_dir_all()?;
|
||||
@@ -4105,7 +4105,7 @@ fn init_project_flag_is_not_allowed_under_preview() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn init_project_flag_is_ignored_with_explicit_path() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// with explicit path
|
||||
uv_snapshot!(context.filters(), context.init().arg("--project").arg("bar").arg("foo"), @"
|
||||
@@ -4138,7 +4138,7 @@ fn init_project_flag_is_ignored_with_explicit_path() {
|
||||
|
||||
#[test]
|
||||
fn init_project_flag_is_warned_without_path() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// with explicit path
|
||||
uv_snapshot!(context.filters(), context.init().arg("--project").arg("bar"), @"
|
||||
@@ -4160,7 +4160,7 @@ fn init_project_flag_is_warned_without_path() {
|
||||
/// The `--directory` flag is used as the base for path
|
||||
#[test]
|
||||
fn init_working_directory_change() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let child = context.temp_dir.child("bar");
|
||||
child.create_dir_all()?;
|
||||
|
||||
+294
-295
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ use anyhow::Result;
|
||||
use assert_fs::prelude::*;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
// All of the tests in this file should use `tool.uv.conflicts` in some way.
|
||||
//
|
||||
@@ -20,7 +20,7 @@ use crate::common::{TestContext, uv_snapshot};
|
||||
/// <https://github.com/astral-sh/uv/issues/8024>
|
||||
#[test]
|
||||
fn extra_basic() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// First we test that resolving with two extras that have
|
||||
// conflicting dependencies fails.
|
||||
@@ -211,7 +211,7 @@ fn extra_basic() -> Result<()> {
|
||||
/// extras instead of two.
|
||||
#[test]
|
||||
fn extra_basic_three_extras() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// First we test that resolving with two extras that have
|
||||
// conflicting dependencies fails.
|
||||
@@ -357,7 +357,7 @@ fn extra_basic_three_extras() -> Result<()> {
|
||||
/// distinct groups of extras.
|
||||
#[test]
|
||||
fn extra_multiple_not_conflicting1() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -487,7 +487,7 @@ fn extra_multiple_not_conflicting1() -> Result<()> {
|
||||
/// conflicting.)
|
||||
#[test]
|
||||
fn extra_multiple_not_conflicting2() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -648,7 +648,7 @@ fn extra_multiple_not_conflicting2() -> Result<()> {
|
||||
/// extras correctly.
|
||||
#[test]
|
||||
fn extra_multiple_independent() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// If we don't declare any conflicting extras, then resolution
|
||||
// will of course fail.
|
||||
@@ -871,7 +871,7 @@ fn extra_multiple_independent() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn extra_config_change_ignore_lockfile() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1005,7 +1005,7 @@ fn extra_config_change_ignore_lockfile() -> Result<()> {
|
||||
/// enables a conflicting extra.
|
||||
#[test]
|
||||
fn extra_unconditional() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let root_pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
root_pyproject_toml.write_str(
|
||||
@@ -1158,7 +1158,7 @@ fn extra_unconditional() -> Result<()> {
|
||||
/// would be completely ignored here.
|
||||
#[test]
|
||||
fn extra_unconditional_non_conflicting() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let root_pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
root_pyproject_toml.write_str(
|
||||
@@ -1236,7 +1236,7 @@ fn extra_unconditional_non_conflicting() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn extra_unconditional_in_optional() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let root_pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
root_pyproject_toml.write_str(
|
||||
@@ -1348,7 +1348,7 @@ fn extra_unconditional_in_optional() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn extra_unconditional_non_local_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let root_pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
root_pyproject_toml.write_str(
|
||||
@@ -1454,7 +1454,7 @@ fn extra_unconditional_non_local_conflict() -> Result<()> {
|
||||
/// packages in a workspace.
|
||||
#[test]
|
||||
fn extra_nested_across_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let root_pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
root_pyproject_toml.write_str(
|
||||
@@ -1656,7 +1656,7 @@ fn extra_nested_across_workspace() -> Result<()> {
|
||||
/// The project declares conflicting extras, but one of the extras directly depends on the other.
|
||||
#[test]
|
||||
fn extra_depends_on_conflicting_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1708,7 +1708,7 @@ fn extra_depends_on_conflicting_extra() -> Result<()> {
|
||||
/// another package.
|
||||
#[test]
|
||||
fn extra_depends_on_conflicting_extra_transitive() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1899,7 +1899,7 @@ fn extra_depends_on_conflicting_extra_transitive() -> Result<()> {
|
||||
/// This tests a "basic" case for specifying conflicting groups.
|
||||
#[test]
|
||||
fn group_basic() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// First we test that resolving with two groups that have
|
||||
// conflicting dependencies fails.
|
||||
@@ -2082,7 +2082,7 @@ fn group_basic() -> Result<()> {
|
||||
/// default.
|
||||
#[test]
|
||||
fn group_default() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Tell uv about the conflicting groups, which forces it to resolve each in
|
||||
// their own fork.
|
||||
@@ -2262,7 +2262,7 @@ fn group_default() -> Result<()> {
|
||||
/// This tests a case where we declare an extra and a group as conflicting.
|
||||
#[test]
|
||||
fn mixed() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// First we test that resolving with a conflicting extra
|
||||
// and group fails.
|
||||
@@ -2450,7 +2450,7 @@ fn mixed() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn multiple_sources_index_disjoint_extras() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2600,7 +2600,7 @@ fn multiple_sources_index_disjoint_extras() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn multiple_sources_index_disjoint_groups() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2749,7 +2749,7 @@ fn multiple_sources_index_disjoint_groups() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn multiple_sources_index_disjoint_extras_with_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2918,7 +2918,7 @@ fn multiple_sources_index_disjoint_extras_with_extra() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn multiple_sources_index_disjoint_extras_with_marker() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3098,7 +3098,7 @@ fn multiple_sources_index_disjoint_extras_with_marker() -> Result<()> {
|
||||
/// despite `sniffio` being an unconditional dependency.
|
||||
#[test]
|
||||
fn non_optional_dependency_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3145,7 +3145,7 @@ fn non_optional_dependency_extra() -> Result<()> {
|
||||
/// This test never regressed, but we added it here to ensure it doesn't.
|
||||
#[test]
|
||||
fn non_optional_dependency_group() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3193,7 +3193,7 @@ fn non_optional_dependency_group() -> Result<()> {
|
||||
/// This test never regressed, but we added it here to ensure it doesn't.
|
||||
#[test]
|
||||
fn non_optional_dependency_mixed() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3249,7 +3249,7 @@ fn non_optional_dependency_mixed() -> Result<()> {
|
||||
/// [1]: <https://github.com/astral-sh/uv/issues/9289>
|
||||
#[test]
|
||||
fn shared_optional_dependency_extra1() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3389,7 +3389,7 @@ fn shared_optional_dependency_extra1() -> Result<()> {
|
||||
/// Ref <https://github.com/astral-sh/uv/issues/9289>
|
||||
#[test]
|
||||
fn shared_optional_dependency_group1() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3528,7 +3528,7 @@ fn shared_optional_dependency_group1() -> Result<()> {
|
||||
/// Ref <https://github.com/astral-sh/uv/issues/9289>
|
||||
#[test]
|
||||
fn shared_optional_dependency_mixed1() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3676,7 +3676,7 @@ fn shared_optional_dependency_mixed1() -> Result<()> {
|
||||
/// Regression test for: <https://github.com/astral-sh/uv/issues/9640>
|
||||
#[test]
|
||||
fn shared_optional_dependency_extra2() -> Result<()> {
|
||||
let context = TestContext::new("3.11");
|
||||
let context = uv_test::test_context!("3.11");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3817,7 +3817,7 @@ fn shared_optional_dependency_extra2() -> Result<()> {
|
||||
/// Regression test for: <https://github.com/astral-sh/uv/issues/9640>
|
||||
#[test]
|
||||
fn shared_optional_dependency_group2() -> Result<()> {
|
||||
let context = TestContext::new("3.11");
|
||||
let context = uv_test::test_context!("3.11");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -3961,7 +3961,7 @@ fn shared_optional_dependency_group2() -> Result<()> {
|
||||
/// Regression test for: <https://github.com/astral-sh/uv/issues/9640>
|
||||
#[test]
|
||||
fn shared_optional_dependency_mixed2() -> Result<()> {
|
||||
let context = TestContext::new("3.11");
|
||||
let context = uv_test::test_context!("3.11");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4110,7 +4110,7 @@ fn shared_optional_dependency_mixed2() -> Result<()> {
|
||||
/// Regression test for: <https://github.com/astral-sh/uv/issues/9289>
|
||||
#[test]
|
||||
fn shared_dependency_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4285,7 +4285,7 @@ fn shared_dependency_extra() -> Result<()> {
|
||||
/// Regression test for: <https://github.com/astral-sh/uv/issues/9289>
|
||||
#[test]
|
||||
fn shared_dependency_group() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4459,7 +4459,7 @@ fn shared_dependency_group() -> Result<()> {
|
||||
/// Regression test for: <https://github.com/astral-sh/uv/issues/9289>
|
||||
#[test]
|
||||
fn shared_dependency_mixed() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -4647,7 +4647,7 @@ fn shared_dependency_mixed() -> Result<()> {
|
||||
/// Ref <https://github.com/astral-sh/uv/issues/9289>
|
||||
#[test]
|
||||
fn extras_are_namespaced() -> Result<()> {
|
||||
let context = TestContext::new("3.11");
|
||||
let context = uv_test::test_context!("3.11");
|
||||
|
||||
let root_pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
root_pyproject_toml.write_str(
|
||||
@@ -4856,7 +4856,7 @@ conflicts = [
|
||||
/// [1]: <https://github.com/astral-sh/uv/issues/9289>
|
||||
#[test]
|
||||
fn jinja_no_conflict_markers1() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5018,7 +5018,7 @@ fn jinja_no_conflict_markers1() -> Result<()> {
|
||||
/// shouldn't see any conflict markers in the lock file here.
|
||||
#[test]
|
||||
fn jinja_no_conflict_markers2() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-01-30T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5193,7 +5193,7 @@ fn jinja_no_conflict_markers2() -> Result<()> {
|
||||
/// Ref: <https://github.com/astral-sh/uv/pull/9370#discussion_r1876083284>
|
||||
#[test]
|
||||
fn collision_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5411,7 +5411,7 @@ fn collision_extra() -> Result<()> {
|
||||
/// Ref: <https://github.com/astral-sh/uv/pull/9370#discussion_r1875958904>
|
||||
#[test]
|
||||
fn extra_inferences() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -7453,7 +7453,7 @@ fn extra_inferences() -> Result<()> {
|
||||
/// [1]: <https://github.com/astral-sh/uv/issues/9296>
|
||||
#[test]
|
||||
fn deduplicate_resolution_markers() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -7602,7 +7602,7 @@ fn deduplicate_resolution_markers() -> Result<()> {
|
||||
/// Ref: <https://github.com/astral-sh/uv/issues/11133>
|
||||
#[test]
|
||||
fn incorrect_extra_simplification_leads_to_multiple_torch_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-02-07T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-02-07T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -10352,7 +10352,7 @@ fn incorrect_extra_simplification_leads_to_multiple_torch_packages() -> Result<(
|
||||
/// Ref: <https://github.com/astral-sh/uv/issues/11479>
|
||||
#[test]
|
||||
fn duplicate_torch_and_sympy_because_of_wrong_inferences() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-02-14T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-02-14T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -13596,7 +13596,7 @@ fn duplicate_torch_and_sympy_because_of_wrong_inferences() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn overlapping_resolution_markers() -> Result<()> {
|
||||
let context = TestContext::new("3.10").with_exclude_newer("2025-01-30T00:00Z");
|
||||
let context = uv_test::test_context!("3.10").with_exclude_newer("2025-01-30T00:00Z");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -14273,7 +14273,7 @@ fn overlapping_resolution_markers() -> Result<()> {
|
||||
/// Ref: <https://github.com/astral-sh/uv/issues/9735>
|
||||
#[test]
|
||||
fn avoids_exponential_lock_file_growth() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-02-06T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-02-06T00:00Z");
|
||||
|
||||
let pyproject = r#"
|
||||
[project]
|
||||
@@ -15155,7 +15155,7 @@ fn avoids_exponential_lock_file_growth() -> Result<()> {
|
||||
/// Ref: <https://github.com/astral-sh/uv/issues/14805>
|
||||
#[test]
|
||||
fn do_not_simplify_if_not_all_conflict_extras_satisfy_the_marker_by_themselves() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_exclude_newer("2025-02-06T00:00Z");
|
||||
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-02-06T00:00Z");
|
||||
|
||||
let pyproject = r#"
|
||||
[project]
|
||||
@@ -15307,7 +15307,7 @@ fn do_not_simplify_if_not_all_conflict_extras_satisfy_the_marker_by_themselves()
|
||||
/// silently ignored.
|
||||
#[test]
|
||||
fn conflict_item_unknown_field() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
|
||||
@@ -3,7 +3,7 @@ use assert_fs::fixture::{FileWriteStr, PathChild};
|
||||
use insta::assert_snapshot;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
/// Lock with a relative exclude-newer value.
|
||||
///
|
||||
@@ -12,7 +12,7 @@ use crate::common::{TestContext, uv_snapshot};
|
||||
/// - 3.7: 2024-04-11
|
||||
#[test]
|
||||
fn lock_exclude_newer_relative() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -218,7 +218,7 @@ fn lock_exclude_newer_relative() -> Result<()> {
|
||||
/// - 3.7: 2024-04-11
|
||||
#[test]
|
||||
fn lock_exclude_newer_older_vs_newer() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -333,7 +333,7 @@ fn lock_exclude_newer_older_vs_newer() -> Result<()> {
|
||||
/// - 3.7: 2024-04-11
|
||||
#[test]
|
||||
fn lock_exclude_newer_package_relative() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -523,7 +523,7 @@ fn lock_exclude_newer_package_relative() -> Result<()> {
|
||||
/// - 3.7: 2024-04-11
|
||||
#[test]
|
||||
fn lock_exclude_newer_relative_pyproject() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -594,7 +594,7 @@ fn lock_exclude_newer_relative_pyproject() -> Result<()> {
|
||||
/// - 3.7: 2024-04-11
|
||||
#[test]
|
||||
fn lock_exclude_newer_package_relative_pyproject() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -670,7 +670,7 @@ fn lock_exclude_newer_package_relative_pyproject() -> Result<()> {
|
||||
/// - 4.11.0: 2024-04-05
|
||||
#[test]
|
||||
fn lock_exclude_newer_relative_global_and_package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -953,7 +953,7 @@ fn lock_exclude_newer_relative_global_and_package() -> Result<()> {
|
||||
/// Lock with various relative exclude newer value formats.
|
||||
#[test]
|
||||
fn lock_exclude_newer_relative_values() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -1199,7 +1199,7 @@ fn lock_exclude_newer_relative_values() -> Result<()> {
|
||||
/// Lock with various relative exclude newer value formats in a `pyproject.toml`.
|
||||
#[test]
|
||||
fn lock_exclude_newer_relative_values_pyproject() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
|
||||
@@ -15,7 +15,7 @@ use insta::assert_snapshot;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, packse_index_url, uv_snapshot};
|
||||
use uv_test::{packse_index_url, uv_snapshot};
|
||||
|
||||
/// There are two packages, `a` and `b`. We select `a` with `a==2.0.0` first, and then `b`, but `a==2.0.0` conflicts with all new versions of `b`, so we backtrack through versions of `b`.
|
||||
///
|
||||
@@ -83,7 +83,7 @@ use crate::common::{TestContext, packse_index_url, uv_snapshot};
|
||||
/// ```
|
||||
#[test]
|
||||
fn wrong_backtracking_basic() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -250,7 +250,7 @@ fn wrong_backtracking_basic() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn wrong_backtracking_indirect() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -392,7 +392,7 @@ fn wrong_backtracking_indirect() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_allows_non_conflicting_non_overlapping_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -510,7 +510,7 @@ fn fork_allows_non_conflicting_non_overlapping_dependencies() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_allows_non_conflicting_repeated_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -613,7 +613,7 @@ fn fork_allows_non_conflicting_repeated_dependencies() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_basic() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -748,7 +748,7 @@ fn fork_basic() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn conflict_in_fork() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -818,7 +818,7 @@ fn conflict_in_fork() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_conflict_unsatisfiable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -899,7 +899,7 @@ fn fork_conflict_unsatisfiable() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_filter_sibling_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1081,7 +1081,7 @@ fn fork_filter_sibling_dependencies() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_upgrade() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1200,7 +1200,7 @@ fn fork_upgrade() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_incomplete_markers() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1355,7 +1355,7 @@ fn fork_incomplete_markers() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_accrue() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1489,7 +1489,7 @@ fn fork_marker_accrue() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_disjoint() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1559,7 +1559,7 @@ fn fork_marker_disjoint() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_inherit_combined_allowed() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1740,7 +1740,7 @@ fn fork_marker_inherit_combined_allowed() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_inherit_combined_disallowed() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1910,7 +1910,7 @@ fn fork_marker_inherit_combined_disallowed() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_inherit_combined() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2073,7 +2073,7 @@ fn fork_marker_inherit_combined() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_inherit_isolated() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2222,7 +2222,7 @@ fn fork_marker_inherit_isolated() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_inherit_transitive() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2379,7 +2379,7 @@ fn fork_marker_inherit_transitive() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_inherit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2517,7 +2517,7 @@ fn fork_marker_inherit() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_limited_inherit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2673,7 +2673,7 @@ fn fork_marker_limited_inherit() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_selection() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2829,7 +2829,7 @@ fn fork_marker_selection() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_marker_track() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2983,7 +2983,7 @@ fn fork_marker_track() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_non_fork_marker_transitive() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3118,7 +3118,7 @@ fn fork_non_fork_marker_transitive() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_non_local_fork_marker_direct() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3190,7 +3190,7 @@ fn fork_non_local_fork_marker_direct() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_non_local_fork_marker_transitive() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3278,7 +3278,7 @@ fn fork_non_local_fork_marker_transitive() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_overlapping_markers_basic() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3448,7 +3448,7 @@ fn fork_overlapping_markers_basic() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn preferences_dependent_forking_bistable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3683,7 +3683,7 @@ fn preferences_dependent_forking_bistable() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn preferences_dependent_forking_conflicting() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3825,7 +3825,7 @@ fn preferences_dependent_forking_conflicting() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn preferences_dependent_forking_tristable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4109,7 +4109,7 @@ fn preferences_dependent_forking_tristable() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn preferences_dependent_forking() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4285,7 +4285,7 @@ fn preferences_dependent_forking() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_remaining_universe_partitioning() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4438,7 +4438,7 @@ fn fork_remaining_universe_partitioning() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_requires_python_full_prerelease() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4522,7 +4522,7 @@ fn fork_requires_python_full_prerelease() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_requires_python_full() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4611,7 +4611,7 @@ fn fork_requires_python_full() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_requires_python_patch_overlap() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4704,7 +4704,7 @@ fn fork_requires_python_patch_overlap() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn fork_requires_python() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4785,7 +4785,7 @@ fn fork_requires_python() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn requires_python_wheels() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4882,7 +4882,7 @@ fn requires_python_wheels() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn unreachable_package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4982,7 +4982,7 @@ fn unreachable_package() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn unreachable_wheels() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -5114,7 +5114,7 @@ fn unreachable_wheels() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn marker_variants_have_different_extras() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -5252,7 +5252,7 @@ fn marker_variants_have_different_extras() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn virtual_package_extra_priorities() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -5373,7 +5373,7 @@ fn virtual_package_extra_priorities() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn specific_architecture() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
//! this is the single integration test, as documented by matklad
|
||||
//! in <https://matklad.github.io/2021/02/27/delete-cargo-integration-tests.html>
|
||||
|
||||
pub(crate) mod common;
|
||||
|
||||
mod auth;
|
||||
|
||||
mod branching_urls;
|
||||
|
||||
@@ -16,8 +16,7 @@ use wiremock::matchers::{any, method};
|
||||
use wiremock::{Mock, MockServer, Request, ResponseTemplate};
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::{TestContext, uv_snapshot};
|
||||
|
||||
/// Creates a CONNECT tunnel proxy that forwards connections to the target.
|
||||
///
|
||||
@@ -237,7 +236,7 @@ fn read_timeout_server() -> (String, impl Drop) {
|
||||
/// Check the simple index error message when the server returns HTTP status 500, a retryable error.
|
||||
#[tokio::test]
|
||||
async fn simple_http_500() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (_server_drop_guard, mock_server_uri) = http_error_server().await;
|
||||
|
||||
@@ -262,7 +261,7 @@ async fn simple_http_500() {
|
||||
/// Check the simple index error message when the server returns a retryable IO error.
|
||||
#[tokio::test]
|
||||
async fn simple_io_err() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (_server_drop_guard, mock_server_uri) = io_error_server().await;
|
||||
|
||||
@@ -289,7 +288,7 @@ async fn simple_io_err() {
|
||||
/// Check the find links error message when the server returns HTTP status 500, a retryable error.
|
||||
#[tokio::test]
|
||||
async fn find_links_http_500() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (_server_drop_guard, mock_server_uri) = http_error_server().await;
|
||||
|
||||
@@ -316,7 +315,7 @@ async fn find_links_http_500() {
|
||||
/// Check the find links error message when the server returns a retryable IO error.
|
||||
#[tokio::test]
|
||||
async fn find_links_io_error() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (_server_drop_guard, mock_server_uri) = io_error_server().await;
|
||||
|
||||
@@ -346,7 +345,7 @@ async fn find_links_io_error() {
|
||||
/// returns different kinds of retryable errors.
|
||||
#[tokio::test]
|
||||
async fn find_links_mixed_error() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (_server_drop_guard, mock_server_uri) = mixed_error_server().await;
|
||||
|
||||
@@ -374,7 +373,7 @@ async fn find_links_mixed_error() {
|
||||
/// error.
|
||||
#[tokio::test]
|
||||
async fn direct_url_http_500() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (_server_drop_guard, mock_server_uri) = http_error_server().await;
|
||||
|
||||
@@ -401,7 +400,7 @@ async fn direct_url_http_500() {
|
||||
/// Check the direct package URL error message when the server returns a retryable IO error.
|
||||
#[tokio::test]
|
||||
async fn direct_url_io_error() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (_server_drop_guard, mock_server_uri) = io_error_server().await;
|
||||
|
||||
@@ -431,7 +430,7 @@ async fn direct_url_io_error() {
|
||||
/// different kinds of retryable errors.
|
||||
#[tokio::test]
|
||||
async fn direct_url_mixed_error() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (_server_drop_guard, mock_server_uri) = mixed_error_server().await;
|
||||
|
||||
@@ -485,7 +484,7 @@ fn write_python_downloads_json(context: &TestContext, mock_server_uri: &String)
|
||||
/// error.
|
||||
#[tokio::test]
|
||||
async fn python_install_http_500() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs();
|
||||
@@ -516,7 +515,7 @@ async fn python_install_http_500() {
|
||||
/// Check the Python install error message when the server returns a retryable IO error.
|
||||
#[tokio::test]
|
||||
async fn python_install_io_error() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs();
|
||||
@@ -548,7 +547,7 @@ async fn python_install_io_error() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn install_http_retries() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let server = MockServer::start().await;
|
||||
|
||||
@@ -621,7 +620,7 @@ async fn install_http_retries() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn install_http_retry_low_level() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let server = MockServer::start().await;
|
||||
|
||||
@@ -656,7 +655,7 @@ async fn install_http_retry_low_level() {
|
||||
/// Test problem details with a 403 error containing license compliance information
|
||||
#[tokio::test]
|
||||
async fn rfc9457_problem_details_license_violation() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let server = MockServer::start().await;
|
||||
|
||||
@@ -704,7 +703,7 @@ async fn rfc9457_problem_details_license_violation() {
|
||||
/// Test that invalid proxy URL in uv.toml produces a helpful error message.
|
||||
#[tokio::test]
|
||||
async fn proxy_invalid_url_in_uv_toml() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let uv_toml = context.temp_dir.child("uv.toml");
|
||||
uv_toml
|
||||
@@ -735,7 +734,7 @@ async fn proxy_invalid_url_in_uv_toml() {
|
||||
/// Test that invalid proxy URL (not a URL) in uv.toml produces a helpful error message.
|
||||
#[tokio::test]
|
||||
async fn proxy_invalid_url_not_a_url_in_uv_toml() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let uv_toml = context.temp_dir.child("uv.toml");
|
||||
uv_toml
|
||||
@@ -767,7 +766,7 @@ async fn proxy_invalid_url_not_a_url_in_uv_toml() {
|
||||
#[cfg(feature = "test-pypi")]
|
||||
#[tokio::test]
|
||||
async fn proxy_valid_url_in_uv_toml() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let target_server = MockServer::start().await;
|
||||
Mock::given(any())
|
||||
@@ -826,7 +825,7 @@ async fn proxy_valid_url_in_uv_toml() {
|
||||
#[cfg(feature = "test-pypi")]
|
||||
#[test]
|
||||
fn proxy_https_proxy_in_uv_toml() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let proxy_addr = start_connect_tunnel_proxy();
|
||||
let proxy_uri = format!("http://{proxy_addr}");
|
||||
@@ -863,7 +862,7 @@ fn proxy_https_proxy_in_uv_toml() {
|
||||
#[cfg(feature = "test-pypi")]
|
||||
#[tokio::test]
|
||||
async fn proxy_no_proxy_in_uv_toml() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let target_server = MockServer::start().await;
|
||||
mock_simple_api(&target_server).await;
|
||||
@@ -931,7 +930,7 @@ no-proxy = ["{target_host}"]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
#[tokio::test]
|
||||
async fn proxy_schemeless_url_in_uv_toml() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let target_server = MockServer::start().await;
|
||||
Mock::given(any())
|
||||
@@ -994,7 +993,7 @@ async fn proxy_schemeless_url_in_uv_toml() {
|
||||
|
||||
#[test]
|
||||
fn connect_timeout_index() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a server that never responds, causing a timeout for our requests.
|
||||
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
@@ -1029,7 +1028,7 @@ fn connect_timeout_index() {
|
||||
|
||||
#[test]
|
||||
fn connect_timeout_stream() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a server that never responds, causing a timeout for our requests.
|
||||
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
@@ -1063,7 +1062,7 @@ fn connect_timeout_stream() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn retry_read_timeout_index() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (server, _guard) = read_timeout_server();
|
||||
|
||||
@@ -1090,7 +1089,7 @@ async fn retry_read_timeout_index() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn retry_read_timeout_stream() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let (server, _guard) = read_timeout_server();
|
||||
|
||||
|
||||
@@ -2,12 +2,11 @@ use anyhow::Result;
|
||||
use assert_fs::fixture::FileWriteStr;
|
||||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use crate::common::TestContext;
|
||||
use crate::common::uv_snapshot;
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn check_compatible_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0")?;
|
||||
@@ -51,7 +50,7 @@ fn check_compatible_packages() -> Result<()> {
|
||||
// this test force-installs idna 2.4 to trigger a failure.
|
||||
#[test]
|
||||
fn check_incompatible_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0")?;
|
||||
@@ -120,7 +119,7 @@ fn check_incompatible_packages() -> Result<()> {
|
||||
// with multiple incompatible packages.
|
||||
#[test]
|
||||
fn check_multiple_incompatible_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0")?;
|
||||
@@ -190,7 +189,7 @@ fn check_multiple_incompatible_packages() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn check_python_version() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context
|
||||
.pip_install()
|
||||
|
||||
+378
-378
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ use predicates::prelude::predicate;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{
|
||||
use uv_test::{
|
||||
TestContext, build_vendor_links_url, get_bin, packse_index_url, python_path_with_versions,
|
||||
uv_snapshot,
|
||||
};
|
||||
@@ -23,7 +23,7 @@ use crate::common::{
|
||||
fn command(context: &TestContext, python_versions: &[&str]) -> Command {
|
||||
let python_path = python_path_with_versions(&context.temp_dir, python_versions)
|
||||
.expect("Failed to create Python test path");
|
||||
let mut command = Command::new(get_bin());
|
||||
let mut command = Command::new(get_bin!());
|
||||
command
|
||||
.arg("pip")
|
||||
.arg("compile")
|
||||
@@ -54,7 +54,7 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
|
||||
/// ```
|
||||
#[test]
|
||||
fn compatible_python_incompatible_override() -> Result<()> {
|
||||
let context = TestContext::new("3.11");
|
||||
let context = uv_test::test_context!("3.11");
|
||||
let python_versions = &[];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
@@ -102,7 +102,7 @@ fn compatible_python_incompatible_override() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn incompatible_python_compatible_override_available_no_wheels() -> Result<()> {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
let python_versions = &["3.11"];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
@@ -155,7 +155,7 @@ fn incompatible_python_compatible_override_available_no_wheels() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn incompatible_python_compatible_override_no_compatible_wheels() -> Result<()> {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
let python_versions = &[];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
@@ -210,7 +210,7 @@ fn incompatible_python_compatible_override_no_compatible_wheels() -> Result<()>
|
||||
/// ```
|
||||
#[test]
|
||||
fn incompatible_python_compatible_override_other_wheel() -> Result<()> {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
let python_versions = &[];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
@@ -261,7 +261,7 @@ fn incompatible_python_compatible_override_other_wheel() -> Result<()> {
|
||||
/// ```
|
||||
#[test]
|
||||
fn incompatible_python_compatible_override_unavailable_no_wheels() -> Result<()> {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
let python_versions = &[];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
@@ -313,7 +313,7 @@ fn incompatible_python_compatible_override_unavailable_no_wheels() -> Result<()>
|
||||
/// ```
|
||||
#[test]
|
||||
fn incompatible_python_compatible_override() -> Result<()> {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
let python_versions = &[];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
@@ -363,7 +363,7 @@ fn incompatible_python_compatible_override() -> Result<()> {
|
||||
#[cfg(feature = "test-python-patch")]
|
||||
#[test]
|
||||
fn python_patch_override_no_patch() -> Result<()> {
|
||||
let context = TestContext::new("3.9.20");
|
||||
let context = uv_test::test_context!("3.9.20");
|
||||
let python_versions = &[];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
@@ -411,7 +411,7 @@ fn python_patch_override_no_patch() -> Result<()> {
|
||||
#[cfg(feature = "test-python-patch")]
|
||||
#[test]
|
||||
fn python_patch_override_patch_compatible() -> Result<()> {
|
||||
let context = TestContext::new("3.9.20");
|
||||
let context = uv_test::test_context!("3.9.20");
|
||||
let python_versions = &[];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn debug_warn() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.pip_debug(), @"
|
||||
success: false
|
||||
|
||||
@@ -3,11 +3,11 @@ use assert_cmd::prelude::*;
|
||||
use assert_fs::fixture::ChildPath;
|
||||
use assert_fs::prelude::*;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn freeze_many() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3\ntomli==2.0.1")?;
|
||||
@@ -42,7 +42,7 @@ fn freeze_duplicate() -> Result<()> {
|
||||
use uv_fs::copy_dir_all;
|
||||
|
||||
// Sync a version of `pip` into a virtual environment.
|
||||
let context1 = TestContext::new("3.12");
|
||||
let context1 = uv_test::test_context!("3.12");
|
||||
let requirements_txt = context1.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("pip==21.3.1")?;
|
||||
|
||||
@@ -54,7 +54,7 @@ fn freeze_duplicate() -> Result<()> {
|
||||
.success();
|
||||
|
||||
// Sync a different version of `pip` into a virtual environment.
|
||||
let context2 = TestContext::new("3.12");
|
||||
let context2 = uv_test::test_context!("3.12");
|
||||
let requirements_txt = context2.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("pip==22.1.1")?;
|
||||
|
||||
@@ -92,7 +92,7 @@ fn freeze_duplicate() -> Result<()> {
|
||||
/// List a direct URL package in a virtual environment.
|
||||
#[test]
|
||||
fn freeze_url() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio\niniconfig @ https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl")?;
|
||||
@@ -124,7 +124,7 @@ fn freeze_url() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn freeze_with_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(&format!(
|
||||
@@ -178,7 +178,7 @@ fn freeze_with_editable() -> Result<()> {
|
||||
/// Show an `.egg-info` package in a virtual environment.
|
||||
#[test]
|
||||
fn freeze_with_egg_info() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
@@ -231,7 +231,7 @@ fn freeze_with_egg_info() -> Result<()> {
|
||||
/// Python version.
|
||||
#[test]
|
||||
fn freeze_with_egg_info_no_py() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
@@ -283,7 +283,7 @@ fn freeze_with_egg_info_no_py() -> Result<()> {
|
||||
/// Show a set of `.egg-info` files in a virtual environment.
|
||||
#[test]
|
||||
fn freeze_with_egg_info_file() -> Result<()> {
|
||||
let context = TestContext::new("3.11");
|
||||
let context = uv_test::test_context!("3.11");
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
// Manually create a `.egg-info` file with python version.
|
||||
@@ -319,7 +319,7 @@ fn freeze_with_egg_info_file() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn freeze_with_legacy_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
@@ -357,7 +357,7 @@ Version: 0.22.0
|
||||
|
||||
#[test]
|
||||
fn freeze_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3\ntomli==2.0.1")?;
|
||||
@@ -391,7 +391,7 @@ fn freeze_path() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn freeze_multiple_paths() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt1 = context.temp_dir.child("requirements1.txt");
|
||||
requirements_txt1.write_str("MarkupSafe==2.1.3\ntomli==2.0.1")?;
|
||||
@@ -434,7 +434,7 @@ fn freeze_multiple_paths() -> Result<()> {
|
||||
// We follow pip in just ignoring nonexistent paths
|
||||
#[test]
|
||||
fn freeze_nonexistent_path() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let nonexistent_dir = {
|
||||
let dir = context.temp_dir.child("blahblah");
|
||||
@@ -456,7 +456,7 @@ fn freeze_nonexistent_path() {
|
||||
|
||||
#[test]
|
||||
fn freeze_with_quiet_flag() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3\ntomli==2.0.1")?;
|
||||
@@ -485,7 +485,7 @@ fn freeze_with_quiet_flag() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn freeze_target() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3\ntomli==2.0.1")?;
|
||||
@@ -531,7 +531,7 @@ fn freeze_target() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn freeze_prefix() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3\ntomli==2.0.1")?;
|
||||
@@ -577,7 +577,7 @@ fn freeze_prefix() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn freeze_exclude() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let prefix = context.temp_dir.child("prefix");
|
||||
|
||||
|
||||
+298
-298
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ use std::process::Command;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, build_vendor_links_url, packse_index_url, uv_snapshot};
|
||||
use uv_test::{TestContext, build_vendor_links_url, packse_index_url, uv_snapshot};
|
||||
|
||||
/// Create a `pip install` command with options shared across all scenarios.
|
||||
fn command(context: &TestContext) -> Command {
|
||||
@@ -37,7 +37,7 @@ fn command(context: &TestContext) -> Command {
|
||||
/// ```
|
||||
#[test]
|
||||
fn requires_exact_version_does_not_exist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -73,7 +73,7 @@ fn requires_exact_version_does_not_exist() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn requires_greater_version_does_not_exist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -110,7 +110,7 @@ fn requires_greater_version_does_not_exist() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn requires_less_version_does_not_exist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -143,7 +143,7 @@ fn requires_less_version_does_not_exist() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn requires_package_does_not_exist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -180,7 +180,7 @@ fn requires_package_does_not_exist() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_requires_package_does_not_exist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -262,7 +262,7 @@ fn transitive_requires_package_does_not_exist() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn dependency_excludes_non_contiguous_range_of_compatible_versions() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -365,7 +365,7 @@ fn dependency_excludes_non_contiguous_range_of_compatible_versions() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn dependency_excludes_range_of_compatible_versions() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -442,7 +442,7 @@ fn dependency_excludes_range_of_compatible_versions() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn excluded_only_compatible_version() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -495,7 +495,7 @@ fn excluded_only_compatible_version() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn excluded_only_version() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -558,7 +558,7 @@ fn excluded_only_version() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn all_extras_required() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -609,7 +609,7 @@ fn all_extras_required() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn extra_does_not_exist_backtrack() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -659,7 +659,7 @@ fn extra_does_not_exist_backtrack() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn extra_incompatible_with_extra_not_requested() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -710,7 +710,7 @@ fn extra_incompatible_with_extra_not_requested() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn extra_incompatible_with_extra() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -757,7 +757,7 @@ fn extra_incompatible_with_extra() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn extra_incompatible_with_root() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -802,7 +802,7 @@ fn extra_incompatible_with_root() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn extra_required() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -841,7 +841,7 @@ fn extra_required() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn missing_extra() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -892,7 +892,7 @@ fn missing_extra() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn multiple_extras_required() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -936,7 +936,7 @@ fn multiple_extras_required() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn direct_incompatible_versions() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -977,7 +977,7 @@ fn direct_incompatible_versions() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_incompatible_versions() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1020,7 +1020,7 @@ fn transitive_incompatible_versions() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_incompatible_with_root_version() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1069,7 +1069,7 @@ fn transitive_incompatible_with_root_version() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_incompatible_with_transitive() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1110,7 +1110,7 @@ fn transitive_incompatible_with_transitive() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_greater_than_or_equal() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1148,7 +1148,7 @@ fn local_greater_than_or_equal() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_greater_than() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1185,7 +1185,7 @@ fn local_greater_than() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_less_than_or_equal() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1223,7 +1223,7 @@ fn local_less_than_or_equal() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_less_than() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1262,7 +1262,7 @@ fn local_less_than() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_not_latest() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1301,7 +1301,7 @@ fn local_not_latest() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_not_used_with_sdist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1341,7 +1341,7 @@ fn local_not_used_with_sdist() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_simple() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1391,7 +1391,7 @@ fn local_simple() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_transitive_backtrack() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1439,7 +1439,7 @@ fn local_transitive_backtrack() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_transitive_conflicting() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1485,7 +1485,7 @@ fn local_transitive_conflicting() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_transitive_confounding() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1533,7 +1533,7 @@ fn local_transitive_confounding() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_transitive_greater_than_or_equal() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1581,7 +1581,7 @@ fn local_transitive_greater_than_or_equal() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_transitive_greater_than() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1627,7 +1627,7 @@ fn local_transitive_greater_than() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_transitive_less_than_or_equal() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1675,7 +1675,7 @@ fn local_transitive_less_than_or_equal() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_transitive_less_than() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1721,7 +1721,7 @@ fn local_transitive_less_than() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_transitive() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1764,7 +1764,7 @@ fn local_transitive() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn local_used_without_sdist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1803,7 +1803,7 @@ fn local_used_without_sdist() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_equal_available() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1842,7 +1842,7 @@ fn post_equal_available() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_equal_not_available() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1879,7 +1879,7 @@ fn post_equal_not_available() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_greater_than_or_equal_post() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1917,7 +1917,7 @@ fn post_greater_than_or_equal_post() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_greater_than_or_equal() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1957,7 +1957,7 @@ fn post_greater_than_or_equal() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_greater_than_post_not_available() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -1993,7 +1993,7 @@ fn post_greater_than_post_not_available() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_greater_than_post() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2031,7 +2031,7 @@ fn post_greater_than_post() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_greater_than() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2066,7 +2066,7 @@ fn post_greater_than() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_less_than_or_equal() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2101,7 +2101,7 @@ fn post_less_than_or_equal() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_less_than() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2137,7 +2137,7 @@ fn post_less_than() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_local_greater_than_post() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2173,7 +2173,7 @@ fn post_local_greater_than_post() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_local_greater_than() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2208,7 +2208,7 @@ fn post_local_greater_than() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn post_simple() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2247,7 +2247,7 @@ fn post_simple() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_multiple_prereleases_kinds() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2289,7 +2289,7 @@ fn package_multiple_prereleases_kinds() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_multiple_prereleases_numbers() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2329,7 +2329,7 @@ fn package_multiple_prereleases_numbers() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_only_prereleases_boundary() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2368,7 +2368,7 @@ fn package_only_prereleases_boundary() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_only_prereleases_in_range() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2406,7 +2406,7 @@ fn package_only_prereleases_in_range() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_only_prereleases() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2450,7 +2450,7 @@ fn package_only_prereleases() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_prerelease_specified_mixed_available() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2492,7 +2492,7 @@ fn package_prerelease_specified_mixed_available() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_prerelease_specified_only_final_available() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2540,7 +2540,7 @@ fn package_prerelease_specified_only_final_available() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_prerelease_specified_only_prerelease_available() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2586,7 +2586,7 @@ fn package_prerelease_specified_only_prerelease_available() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_prereleases_boundary() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2627,7 +2627,7 @@ fn package_prereleases_boundary() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_prereleases_global_boundary() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2672,7 +2672,7 @@ fn package_prereleases_global_boundary() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_prereleases_specifier_boundary() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2711,7 +2711,7 @@ fn package_prereleases_specifier_boundary() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn requires_package_only_prereleases_in_range_global_opt_in() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2756,7 +2756,7 @@ fn requires_package_only_prereleases_in_range_global_opt_in() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn requires_package_prerelease_and_final_any() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2802,7 +2802,7 @@ fn requires_package_prerelease_and_final_any() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_package_only_prereleases_in_range_opt_in() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2857,7 +2857,7 @@ fn transitive_package_only_prereleases_in_range_opt_in() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_package_only_prereleases_in_range() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2900,7 +2900,7 @@ fn transitive_package_only_prereleases_in_range() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_package_only_prereleases() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -2976,7 +2976,7 @@ fn transitive_package_only_prereleases() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_prerelease_and_stable_dependency_many_versions_holes() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3071,7 +3071,7 @@ fn transitive_prerelease_and_stable_dependency_many_versions_holes() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_prerelease_and_stable_dependency_many_versions() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3131,7 +3131,7 @@ fn transitive_prerelease_and_stable_dependency_many_versions() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_prerelease_and_stable_dependency_opt_in() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3198,7 +3198,7 @@ fn transitive_prerelease_and_stable_dependency_opt_in() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_prerelease_and_stable_dependency() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3248,7 +3248,7 @@ fn transitive_prerelease_and_stable_dependency() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn python_greater_than_current_backtrack() {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3293,7 +3293,7 @@ fn python_greater_than_current_backtrack() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn python_greater_than_current_excluded() {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3363,7 +3363,7 @@ fn python_greater_than_current_excluded() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn python_greater_than_current_many() {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3400,7 +3400,7 @@ fn python_greater_than_current_many() {
|
||||
#[cfg(feature = "test-python-patch")]
|
||||
#[test]
|
||||
fn python_greater_than_current_patch() {
|
||||
let context = TestContext::new("3.13.0");
|
||||
let context = uv_test::test_context!("3.13.0");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3437,7 +3437,7 @@ fn python_greater_than_current_patch() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn python_greater_than_current() {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3474,7 +3474,7 @@ fn python_greater_than_current() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn python_less_than_current() {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3512,7 +3512,7 @@ fn python_less_than_current() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn python_version_does_not_exist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3548,7 +3548,7 @@ fn python_version_does_not_exist() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn no_binary() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3587,7 +3587,7 @@ fn no_binary() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn no_build() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3626,7 +3626,7 @@ fn no_build() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn no_sdist_no_wheels_with_matching_abi() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3665,7 +3665,7 @@ fn no_sdist_no_wheels_with_matching_abi() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn no_sdist_no_wheels_with_matching_platform() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3704,7 +3704,7 @@ fn no_sdist_no_wheels_with_matching_platform() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn no_sdist_no_wheels_with_matching_python() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3743,7 +3743,7 @@ fn no_sdist_no_wheels_with_matching_python() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn no_wheels_no_build() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3783,7 +3783,7 @@ fn no_wheels_no_build() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn no_wheels_with_matching_platform() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3818,7 +3818,7 @@ fn no_wheels_with_matching_platform() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn no_wheels() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3853,7 +3853,7 @@ fn no_wheels() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn only_wheels_no_binary() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3893,7 +3893,7 @@ fn only_wheels_no_binary() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn only_wheels() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3928,7 +3928,7 @@ fn only_wheels() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn specific_tag_and_default() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -3964,7 +3964,7 @@ fn specific_tag_and_default() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_only_yanked_in_range() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4004,7 +4004,7 @@ fn package_only_yanked_in_range() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_only_yanked() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4045,7 +4045,7 @@ fn package_only_yanked() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn package_yanked_specified_mixed_available() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4084,7 +4084,7 @@ fn package_yanked_specified_mixed_available() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn requires_package_yanked_and_unyanked_any() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4129,7 +4129,7 @@ fn requires_package_yanked_and_unyanked_any() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_package_only_yanked_in_range_opt_in() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4179,7 +4179,7 @@ fn transitive_package_only_yanked_in_range_opt_in() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_package_only_yanked_in_range() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4224,7 +4224,7 @@ fn transitive_package_only_yanked_in_range() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_package_only_yanked() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4275,7 +4275,7 @@ fn transitive_package_only_yanked() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_yanked_and_unyanked_dependency_opt_in() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
@@ -4343,7 +4343,7 @@ fn transitive_yanked_and_unyanked_dependency_opt_in() {
|
||||
/// ```
|
||||
#[test]
|
||||
fn transitive_yanked_and_unyanked_dependency() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
|
||||
@@ -5,11 +5,11 @@ use assert_fs::fixture::FileWriteStr;
|
||||
use assert_fs::fixture::PathChild;
|
||||
use assert_fs::prelude::*;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn list_empty_columns() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.pip_list()
|
||||
.arg("--format")
|
||||
@@ -25,7 +25,7 @@ fn list_empty_columns() {
|
||||
|
||||
#[test]
|
||||
fn list_empty_freeze() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.pip_list()
|
||||
.arg("--format")
|
||||
@@ -41,7 +41,7 @@ fn list_empty_freeze() {
|
||||
|
||||
#[test]
|
||||
fn list_empty_json() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.pip_list()
|
||||
.arg("--format")
|
||||
@@ -59,7 +59,7 @@ fn list_empty_json() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_single_no_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
||||
@@ -100,7 +100,7 @@ fn list_single_no_editable() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_outdated_columns() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio==3.0.0")?;
|
||||
@@ -141,7 +141,7 @@ fn list_outdated_columns() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_outdated_json() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio==3.0.0")?;
|
||||
@@ -179,7 +179,7 @@ fn list_outdated_json() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn list_outdated_freeze() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.pip_list().arg("--outdated").arg("--format").arg("freeze"), @"
|
||||
success: false
|
||||
@@ -195,7 +195,7 @@ fn list_outdated_freeze() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn list_outdated_git() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(indoc::indoc! {r"
|
||||
@@ -238,7 +238,7 @@ fn list_outdated_git() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_outdated_index() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("anyio==3.0.0")?;
|
||||
@@ -282,7 +282,7 @@ fn list_outdated_index() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_editable() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install the editable package.
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
@@ -328,7 +328,7 @@ fn list_editable() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_editable_only() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install the editable package.
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
@@ -403,7 +403,7 @@ fn list_editable_only() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_exclude() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install the editable package.
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
@@ -486,7 +486,7 @@ fn list_exclude() {
|
||||
#[cfg(feature = "test-pypi")]
|
||||
#[cfg(not(windows))]
|
||||
fn list_format_json() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install the editable package.
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
@@ -552,7 +552,7 @@ fn list_format_json() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_format_freeze() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install the editable package.
|
||||
uv_snapshot!(context.filters(), context
|
||||
@@ -623,7 +623,7 @@ fn list_format_freeze() {
|
||||
|
||||
#[test]
|
||||
fn list_legacy_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
@@ -675,7 +675,7 @@ Version: 0.22.0
|
||||
|
||||
#[test]
|
||||
fn list_legacy_editable_invalid_version() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
@@ -718,7 +718,7 @@ Version: 0.1-bulbasaur
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_ignores_quiet_flag_format_freeze() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install the editable package.
|
||||
uv_snapshot!(context.filters(), context
|
||||
@@ -793,7 +793,7 @@ fn list_ignores_quiet_flag_format_freeze() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_target() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3\ntomli==2.0.1")?;
|
||||
@@ -842,7 +842,7 @@ fn list_target() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn list_prefix() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3\ntomli==2.0.1")?;
|
||||
|
||||
@@ -8,11 +8,11 @@ use indoc::indoc;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn show_empty() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.pip_show(), @"
|
||||
success: false
|
||||
@@ -28,7 +28,7 @@ fn show_empty() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_requires_multiple() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0")?;
|
||||
@@ -78,7 +78,7 @@ fn show_requires_multiple() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_python_version_marker() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("click==8.1.7")?;
|
||||
@@ -128,7 +128,7 @@ fn show_python_version_marker() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_found_single_package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
||||
@@ -173,7 +173,7 @@ fn show_found_single_package() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_found_multiple_packages() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(indoc! {r"
|
||||
@@ -230,7 +230,7 @@ fn show_found_multiple_packages() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_found_one_out_of_three() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(indoc! {r"
|
||||
@@ -283,7 +283,7 @@ fn show_found_one_out_of_three() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_found_one_out_of_two_quiet() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(indoc! {r"
|
||||
@@ -331,7 +331,7 @@ fn show_found_one_out_of_two_quiet() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_empty_quiet() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(indoc! {r"
|
||||
@@ -378,7 +378,7 @@ fn show_empty_quiet() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install the editable package.
|
||||
context
|
||||
@@ -415,7 +415,7 @@ fn show_editable() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_required_by_multiple() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(indoc! {r"
|
||||
@@ -471,7 +471,7 @@ fn show_required_by_multiple() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_files() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context
|
||||
.pip_install()
|
||||
@@ -538,7 +538,7 @@ fn show_files() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_target() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
||||
@@ -590,7 +590,7 @@ fn show_target() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_prefix() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
||||
|
||||
+133
-133
File diff suppressed because it is too large
Load Diff
@@ -7,11 +7,11 @@ use assert_fs::fixture::PathChild;
|
||||
use assert_fs::fixture::PathCreateDir;
|
||||
use indoc::indoc;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn no_package() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_tree(), @"
|
||||
success: true
|
||||
@@ -27,7 +27,7 @@ fn no_package() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn prune_last_in_the_subgroup() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0").unwrap();
|
||||
@@ -71,7 +71,7 @@ fn prune_last_in_the_subgroup() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn single_package() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0").unwrap();
|
||||
@@ -117,7 +117,7 @@ fn single_package() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn nested_dependencies() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask").unwrap();
|
||||
@@ -167,7 +167,7 @@ fn nested_dependencies() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn reverse() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask").unwrap();
|
||||
@@ -219,7 +219,7 @@ fn reverse() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn invert() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask").unwrap();
|
||||
@@ -271,7 +271,7 @@ fn invert() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn depth() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask").unwrap();
|
||||
@@ -350,7 +350,7 @@ fn depth() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn prune() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask").unwrap();
|
||||
@@ -434,7 +434,7 @@ fn prune() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn removed_dependency() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0").unwrap();
|
||||
@@ -490,7 +490,7 @@ fn removed_dependency() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn multiple_packages() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt
|
||||
@@ -545,7 +545,7 @@ fn multiple_packages() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn cycle() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt
|
||||
@@ -613,7 +613,7 @@ fn cycle() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn multiple_packages_shared_descendant() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt
|
||||
@@ -667,7 +667,7 @@ fn multiple_packages_shared_descendant() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn no_dedupe_and_invert() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt
|
||||
@@ -720,7 +720,7 @@ fn no_dedupe_and_invert() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn no_dedupe() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt
|
||||
@@ -774,7 +774,7 @@ fn no_dedupe() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn with_editable() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install the editable package.
|
||||
uv_snapshot!(context.filters(), context
|
||||
@@ -815,7 +815,7 @@ fn with_editable() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn package_flag() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask").unwrap();
|
||||
@@ -883,7 +883,7 @@ fn package_flag() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_version_specifiers_simple() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0").unwrap();
|
||||
@@ -927,7 +927,7 @@ fn show_version_specifiers_simple() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_version_specifiers_with_invert() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask").unwrap();
|
||||
@@ -983,7 +983,7 @@ fn show_version_specifiers_with_invert() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn show_version_specifiers_with_package() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask").unwrap();
|
||||
@@ -1031,7 +1031,7 @@ fn show_version_specifiers_with_package() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn print_output_even_with_quite_flag() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("requests==2.31.0").unwrap();
|
||||
@@ -1071,7 +1071,7 @@ fn print_output_even_with_quite_flag() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn outdated() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask==2.0.0").unwrap();
|
||||
@@ -1138,7 +1138,7 @@ fn no_duplicate_dependencies_with_markers() {
|
||||
build-backend = "uv_build"
|
||||
"#};
|
||||
|
||||
let context = TestContext::new_with_versions(&["3.12", "3.13"]).with_filtered_counts();
|
||||
let context = uv_test::test_context_with_versions!(&["3.12", "3.13"]).with_filtered_counts();
|
||||
|
||||
let project = context.temp_dir.child("debug");
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ use assert_cmd::prelude::*;
|
||||
use assert_fs::fixture::ChildPath;
|
||||
use assert_fs::prelude::*;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn no_arguments() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_uninstall(), @"
|
||||
success: false
|
||||
@@ -27,7 +27,7 @@ fn no_arguments() {
|
||||
|
||||
#[test]
|
||||
fn invalid_requirement() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_uninstall()
|
||||
.arg("flask==1.0.x"), @"
|
||||
@@ -45,7 +45,7 @@ fn invalid_requirement() {
|
||||
|
||||
#[test]
|
||||
fn missing_requirements_txt() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_uninstall()
|
||||
.arg("-r")
|
||||
@@ -62,7 +62,7 @@ fn missing_requirements_txt() {
|
||||
|
||||
#[test]
|
||||
fn invalid_requirements_txt_requirement() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("flask==1.0.x")?;
|
||||
@@ -87,7 +87,7 @@ fn invalid_requirements_txt_requirement() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn uninstall() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
||||
@@ -120,7 +120,7 @@ fn uninstall() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn missing_record() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
||||
@@ -154,7 +154,7 @@ fn missing_record() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn uninstall_editable_by_name() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(&format!(
|
||||
@@ -195,7 +195,7 @@ fn uninstall_editable_by_name() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn uninstall_by_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(
|
||||
@@ -236,7 +236,7 @@ fn uninstall_by_path() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn uninstall_duplicate_by_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(
|
||||
@@ -282,7 +282,7 @@ fn uninstall_duplicate() -> Result<()> {
|
||||
use uv_fs::copy_dir_all;
|
||||
|
||||
// Sync a version of `pip` into a virtual environment.
|
||||
let context1 = TestContext::new("3.12");
|
||||
let context1 = uv_test::test_context!("3.12");
|
||||
let requirements_txt = context1.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("pip==21.3.1")?;
|
||||
|
||||
@@ -294,7 +294,7 @@ fn uninstall_duplicate() -> Result<()> {
|
||||
.success();
|
||||
|
||||
// Sync a different version of `pip` into a virtual environment.
|
||||
let context2 = TestContext::new("3.12");
|
||||
let context2 = uv_test::test_context!("3.12");
|
||||
let requirements_txt = context2.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str("pip==22.1.1")?;
|
||||
|
||||
@@ -331,7 +331,7 @@ fn uninstall_duplicate() -> Result<()> {
|
||||
/// Uninstall a `.egg-info` package in a virtual environment.
|
||||
#[test]
|
||||
fn uninstall_egg_info() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
@@ -393,7 +393,7 @@ fn normcase(s: &str) -> String {
|
||||
/// Uninstall a legacy editable package in a virtual environment.
|
||||
#[test]
|
||||
fn uninstall_legacy_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
@@ -449,7 +449,7 @@ Version: 0.22.0
|
||||
|
||||
#[test]
|
||||
fn dry_run_uninstall_egg_info() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let site_packages = ChildPath::new(context.site_packages());
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::common::{TestContext, uv_snapshot, venv_bin_path};
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::{FileTouch, FileWriteStr, PathChild};
|
||||
use fs_err::OpenOptions;
|
||||
@@ -9,6 +8,7 @@ use std::env::current_dir;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use uv_static::EnvVars;
|
||||
use uv_test::{uv_snapshot, venv_bin_path};
|
||||
use wiremock::matchers::{basic_auth, method, path};
|
||||
use wiremock::{Mock, MockServer, ResponseTemplate};
|
||||
|
||||
@@ -23,7 +23,7 @@ fn dummy_wheel() -> PathBuf {
|
||||
|
||||
#[test]
|
||||
fn username_password_no_longer_supported() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.publish()
|
||||
.arg("-u")
|
||||
@@ -48,7 +48,7 @@ fn username_password_no_longer_supported() {
|
||||
|
||||
#[test]
|
||||
fn invalid_token() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.publish()
|
||||
.arg("-u")
|
||||
@@ -74,7 +74,7 @@ fn invalid_token() {
|
||||
/// Emulate a missing `permission` `id-token: write` situation.
|
||||
#[test]
|
||||
fn mixed_credentials() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.publish()
|
||||
.arg("--username")
|
||||
@@ -102,7 +102,7 @@ fn mixed_credentials() {
|
||||
/// Emulate a missing `permission` `id-token: write` situation.
|
||||
#[test]
|
||||
fn missing_trusted_publishing_permission() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.publish()
|
||||
.arg("--publish-url")
|
||||
@@ -130,7 +130,7 @@ fn missing_trusted_publishing_permission() {
|
||||
/// trusted publishing configuration?
|
||||
#[test]
|
||||
fn no_credentials() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.publish()
|
||||
.arg("--publish-url")
|
||||
@@ -160,7 +160,7 @@ fn no_credentials() {
|
||||
/// Hint people that it's not `--skip-existing` but `--check-url`.
|
||||
#[test]
|
||||
fn skip_existing_redirect() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.publish()
|
||||
.arg("--skip-existing")
|
||||
@@ -178,7 +178,7 @@ fn skip_existing_redirect() {
|
||||
|
||||
#[test]
|
||||
fn dubious_filenames() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.temp_dir.child("not-a-wheel.whl").touch().unwrap();
|
||||
context.temp_dir.child("data.tar.gz").touch().unwrap();
|
||||
@@ -213,7 +213,7 @@ fn dubious_filenames() {
|
||||
/// Check that we (don't) use the keyring and warn for missing keyring behaviors correctly.
|
||||
#[test]
|
||||
fn check_keyring_behaviours() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install our keyring plugin
|
||||
context
|
||||
@@ -337,7 +337,7 @@ fn check_keyring_behaviours() {
|
||||
|
||||
#[test]
|
||||
fn invalid_index() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = indoc! {r#"
|
||||
[project]
|
||||
@@ -407,7 +407,7 @@ fn invalid_index() {
|
||||
/// <https://github.com/astral-sh/uv/issues/11836#issuecomment-3022735011>
|
||||
#[tokio::test]
|
||||
async fn read_index_credential_env_vars_for_check_url() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let server = MockServer::start().await;
|
||||
|
||||
@@ -510,7 +510,7 @@ async fn read_index_credential_env_vars_for_check_url() {
|
||||
/// Native GitLab CI trusted publishing using `PYPI_ID_TOKEN`
|
||||
#[tokio::test]
|
||||
async fn gitlab_trusted_publishing_pypi_id_token() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let server = MockServer::start().await;
|
||||
|
||||
@@ -562,7 +562,7 @@ async fn gitlab_trusted_publishing_pypi_id_token() {
|
||||
/// Native GitLab CI trusted publishing using `TESTPYPI_ID_TOKEN`
|
||||
#[tokio::test]
|
||||
async fn gitlab_trusted_publishing_testpypi_id_token() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let server = MockServer::start().await;
|
||||
|
||||
@@ -616,7 +616,7 @@ async fn gitlab_trusted_publishing_testpypi_id_token() {
|
||||
/// PyPI returns `application/json` errors with a `code` field.
|
||||
#[tokio::test]
|
||||
async fn upload_error_pypi_json() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let server = MockServer::start().await;
|
||||
|
||||
Mock::given(method("POST"))
|
||||
@@ -652,7 +652,7 @@ async fn upload_error_pypi_json() {
|
||||
/// pyx returns `application/problem+json` errors with RFC 9457 Problem Details.
|
||||
#[tokio::test]
|
||||
async fn upload_error_problem_details() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let server = MockServer::start().await;
|
||||
|
||||
Mock::given(method("POST"))
|
||||
@@ -689,7 +689,7 @@ async fn upload_error_problem_details() {
|
||||
/// stopping at the first failure.
|
||||
#[test]
|
||||
fn dry_run_reports_all_errors() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create two fake wheel files that will fail metadata reading.
|
||||
let wheel_a = context.temp_dir.child("a-1.0.0-py3-none-any.whl");
|
||||
|
||||
@@ -2,11 +2,11 @@ use assert_fs::fixture::PathChild;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn python_dir() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let python_dir = context.temp_dir.child("python");
|
||||
uv_snapshot!(context.filters(), context.python_dir()
|
||||
|
||||
@@ -6,12 +6,12 @@ use indoc::indoc;
|
||||
use uv_platform::{Arch, Os};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot, venv_bin_path};
|
||||
use uv_test::{TestContext, uv_snapshot, venv_bin_path};
|
||||
|
||||
#[test]
|
||||
fn python_find() {
|
||||
let mut context: TestContext =
|
||||
TestContext::new_with_versions(&["3.11", "3.12"]).with_filtered_python_sources();
|
||||
uv_test::test_context_with_versions!(&["3.11", "3.12"]).with_filtered_python_sources();
|
||||
|
||||
// No interpreters on the path
|
||||
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @"
|
||||
@@ -152,7 +152,7 @@ fn python_find() {
|
||||
|
||||
#[test]
|
||||
fn python_find_pin() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
|
||||
// Pin to a version
|
||||
uv_snapshot!(context.filters(), context.python_pin().arg("3.12"), @"
|
||||
@@ -229,7 +229,7 @@ fn python_find_pin() {
|
||||
|
||||
#[test]
|
||||
fn python_find_pin_arbitrary_name() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
|
||||
// Try to pin to an arbitrary name
|
||||
uv_snapshot!(context.filters(), context.python_pin().arg("foo"), @"
|
||||
@@ -305,7 +305,7 @@ fn python_find_pin_arbitrary_name() {
|
||||
|
||||
#[test]
|
||||
fn python_find_project() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.10", "3.11", "3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.10", "3.11", "3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml
|
||||
@@ -417,7 +417,7 @@ fn python_find_project() {
|
||||
#[test]
|
||||
fn virtual_empty() {
|
||||
// testing how `uv python find` reacts to a pyproject with no `[project]` and nothing useful to it
|
||||
let context = TestContext::new_with_versions(&["3.10", "3.11", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.10", "3.11", "3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml
|
||||
@@ -504,7 +504,7 @@ fn virtual_dependency_group() {
|
||||
// testing basic `uv python find` functionality
|
||||
// when the pyproject.toml is fully virtual (no `[project]`, but `[dependency-groups]` defined,
|
||||
// which really shouldn't matter)
|
||||
let context = TestContext::new_with_versions(&["3.10", "3.11", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.10", "3.11", "3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml
|
||||
@@ -590,7 +590,7 @@ fn virtual_dependency_group() {
|
||||
|
||||
#[test]
|
||||
fn python_find_venv() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
// Enable additional filters for Windows compatibility
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_python_names()
|
||||
@@ -776,7 +776,7 @@ fn python_find_venv() {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn python_find_unsupported_version() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Request a low version
|
||||
uv_snapshot!(context.filters(), context.python_find().arg("3.6"), @"
|
||||
@@ -851,7 +851,7 @@ fn python_find_unsupported_version() {
|
||||
|
||||
#[test]
|
||||
fn python_find_venv_invalid() {
|
||||
let context: TestContext = TestContext::new("3.12")
|
||||
let context: TestContext = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -904,7 +904,7 @@ fn python_find_venv_invalid() {
|
||||
|
||||
#[test]
|
||||
fn python_find_managed() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_python_sources()
|
||||
.with_versions_as_managed(&["3.12"]);
|
||||
|
||||
@@ -928,7 +928,7 @@ fn python_find_managed() {
|
||||
error: No interpreter found for Python 3.11 in virtual environments or managed installations
|
||||
");
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_python_sources()
|
||||
.with_versions_as_managed(&["3.11"]);
|
||||
|
||||
@@ -983,7 +983,7 @@ fn python_find_managed() {
|
||||
#[cfg(unix)]
|
||||
#[cfg(feature = "test-python-managed")]
|
||||
fn python_required_python_major_minor() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
|
||||
// Find the Python 3.11 executable.
|
||||
let path = &context.python_versions.first().unwrap().1;
|
||||
@@ -1026,7 +1026,7 @@ fn python_required_python_major_minor() {
|
||||
|
||||
#[test]
|
||||
fn python_find_script() {
|
||||
let context = TestContext::new("3.13")
|
||||
let context = uv_test::test_context!("3.13")
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -1063,7 +1063,7 @@ fn python_find_script() {
|
||||
|
||||
#[test]
|
||||
fn python_find_script_no_environment() {
|
||||
let context = TestContext::new("3.13")
|
||||
let context = uv_test::test_context!("3.13")
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -1090,7 +1090,7 @@ fn python_find_script_no_environment() {
|
||||
|
||||
#[test]
|
||||
fn python_find_script_python_not_found() {
|
||||
let context = TestContext::new_with_versions(&[]).with_filtered_python_sources();
|
||||
let context = uv_test::test_context_with_versions!(&[]).with_filtered_python_sources();
|
||||
|
||||
let script = context.temp_dir.child("foo.py");
|
||||
|
||||
@@ -1116,7 +1116,7 @@ fn python_find_script_python_not_found() {
|
||||
|
||||
#[test]
|
||||
fn python_find_script_no_such_version() {
|
||||
let context = TestContext::new("3.13")
|
||||
let context = uv_test::test_context!("3.13")
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -1164,7 +1164,7 @@ fn python_find_script_no_such_version() {
|
||||
#[test]
|
||||
fn python_find_show_version() {
|
||||
let context: TestContext =
|
||||
TestContext::new_with_versions(&["3.11", "3.12"]).with_filtered_python_sources();
|
||||
uv_test::test_context_with_versions!(&["3.11", "3.12"]).with_filtered_python_sources();
|
||||
|
||||
// No interpreters found
|
||||
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, "").arg("--show-version"), @"
|
||||
@@ -1209,7 +1209,8 @@ fn python_find_show_version() {
|
||||
|
||||
#[test]
|
||||
fn python_find_path() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[]).with_filtered_not_executable();
|
||||
let context: TestContext =
|
||||
uv_test::test_context_with_versions!(&[]).with_filtered_not_executable();
|
||||
|
||||
context.temp_dir.child("foo").create_dir_all().unwrap();
|
||||
context.temp_dir.child("bar").touch().unwrap();
|
||||
@@ -1250,7 +1251,7 @@ fn python_find_path() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-python-managed")]
|
||||
fn python_find_freethreaded_313() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_python_sources()
|
||||
.with_managed_python_dirs()
|
||||
@@ -1290,7 +1291,7 @@ fn python_find_freethreaded_313() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-python-managed")]
|
||||
fn python_find_freethreaded_314() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_python_sources()
|
||||
.with_managed_python_dirs()
|
||||
@@ -1368,7 +1369,7 @@ fn python_find_freethreaded_314() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-python-managed")]
|
||||
fn python_find_prerelease_version_specifiers() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_python_sources()
|
||||
.with_managed_python_dirs()
|
||||
@@ -1468,7 +1469,7 @@ fn python_find_prerelease_version_specifiers() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-python-managed")]
|
||||
fn python_find_prerelease_with_patch_request() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_python_sources()
|
||||
.with_managed_python_dirs()
|
||||
|
||||
@@ -3,7 +3,6 @@ use std::path::PathBuf;
|
||||
|
||||
use std::{env, path::Path, process::Command};
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use anyhow::Context;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::{
|
||||
@@ -13,6 +12,7 @@ use assert_fs::{
|
||||
use indoc::indoc;
|
||||
use predicates::prelude::predicate;
|
||||
use tracing::debug;
|
||||
use uv_test::{TestContext, uv_snapshot};
|
||||
|
||||
use uv_fs::Simplified;
|
||||
use uv_python::managed::platform_key_from_env;
|
||||
@@ -21,7 +21,7 @@ use walkdir::WalkDir;
|
||||
|
||||
#[test]
|
||||
fn python_install() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -147,7 +147,7 @@ fn python_install() {
|
||||
|
||||
#[test]
|
||||
fn python_reinstall() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -203,7 +203,7 @@ fn python_reinstall() {
|
||||
|
||||
#[test]
|
||||
fn python_reinstall_patch() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -237,7 +237,7 @@ fn python_reinstall_patch() {
|
||||
|
||||
#[test]
|
||||
fn python_install_automatic() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_python_sources()
|
||||
@@ -349,7 +349,7 @@ fn python_install_automatic() {
|
||||
/// <https://github.com/astral-sh/uv/issues/13610>
|
||||
#[test]
|
||||
fn regression_cpython() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_python_sources()
|
||||
@@ -382,7 +382,7 @@ fn regression_cpython() {
|
||||
|
||||
#[test]
|
||||
fn python_install_force() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -446,7 +446,7 @@ fn python_install_force() {
|
||||
|
||||
#[test]
|
||||
fn python_install_minor() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -506,7 +506,7 @@ fn python_install_minor() {
|
||||
|
||||
#[test]
|
||||
fn python_install_multiple_patch() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs();
|
||||
@@ -586,7 +586,7 @@ fn python_install_multiple_patch() {
|
||||
|
||||
#[test]
|
||||
fn python_install_preview() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -863,7 +863,7 @@ fn python_install_preview() {
|
||||
|
||||
#[test]
|
||||
fn python_install_preview_no_bin() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -911,7 +911,7 @@ fn python_install_preview_no_bin() {
|
||||
|
||||
#[test]
|
||||
fn python_install_preview_upgrade() {
|
||||
let context = TestContext::new_with_versions(&[])
|
||||
let context = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -1070,7 +1070,7 @@ fn python_install_preview_upgrade() {
|
||||
|
||||
#[test]
|
||||
fn python_install_freethreaded() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_latest_python_versions()
|
||||
.with_managed_python_dirs()
|
||||
@@ -1227,7 +1227,7 @@ fn python_install_freethreaded() {
|
||||
|
||||
#[test]
|
||||
fn python_upgrade_not_allowed() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs();
|
||||
@@ -1257,7 +1257,7 @@ fn python_upgrade_not_allowed() {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn python_install_debug() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -1386,7 +1386,7 @@ fn python_install_debug() {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn python_install_debug_freethreaded() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -1536,7 +1536,7 @@ fn python_install_debug_freethreaded() {
|
||||
|
||||
#[test]
|
||||
fn python_install_invalid_request() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -1575,7 +1575,7 @@ fn python_install_invalid_request() {
|
||||
|
||||
#[test]
|
||||
fn python_install_default() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -1815,7 +1815,7 @@ fn python_install_default() {
|
||||
|
||||
#[test]
|
||||
fn python_install_default_preview() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -2203,7 +2203,7 @@ fn read_link(path: &Path) -> String {
|
||||
|
||||
#[test]
|
||||
fn python_install_unknown() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_managed_python_dirs()
|
||||
.with_python_download_cache();
|
||||
|
||||
@@ -2236,7 +2236,7 @@ fn python_install_broken_link() {
|
||||
use assert_fs::prelude::PathCreateDir;
|
||||
use fs_err::os::unix::fs::symlink;
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -2275,7 +2275,7 @@ fn python_install_broken_link() {
|
||||
/// python.exe and python3.exe links for pre-release versions.
|
||||
#[test]
|
||||
fn python_install_default_prerelease() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -2311,7 +2311,7 @@ fn python_install_default_prerelease() {
|
||||
|
||||
#[test]
|
||||
fn python_install_default_from_env() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_latest_python_versions()
|
||||
@@ -2404,7 +2404,7 @@ fn python_install_patch_dylib() {
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use uv_python::managed::platform_key_from_env;
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_managed_python_dirs()
|
||||
.with_python_download_cache();
|
||||
@@ -2447,7 +2447,7 @@ fn python_install_patch_dylib() {
|
||||
|
||||
#[test]
|
||||
fn python_install_prerelease() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_latest_python_versions()
|
||||
.with_managed_python_dirs()
|
||||
@@ -2481,7 +2481,7 @@ fn python_install_prerelease() {
|
||||
|
||||
#[test]
|
||||
fn python_find_prerelease() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_latest_python_versions()
|
||||
.with_managed_python_dirs()
|
||||
@@ -2556,7 +2556,7 @@ fn python_install_cached() {
|
||||
return;
|
||||
}
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -2651,7 +2651,7 @@ fn python_install_no_cache() {
|
||||
return;
|
||||
}
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -2757,7 +2757,7 @@ fn python_install_no_cache() {
|
||||
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
|
||||
#[test]
|
||||
fn python_install_emulated_macos() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
.with_python_download_cache()
|
||||
@@ -2844,7 +2844,7 @@ fn python_install_emulated_macos() {
|
||||
#[cfg(all(target_os = "windows", target_arch = "x86_64"))]
|
||||
#[test]
|
||||
fn python_install_emulated_windows_x86_on_x64() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
.with_python_download_cache()
|
||||
@@ -2916,7 +2916,7 @@ fn python_install_emulated_windows_x86_on_x64() {
|
||||
// A virtual environment should track the latest patch version installed.
|
||||
#[test]
|
||||
fn install_transparent_patch_upgrade_uv_venv() {
|
||||
let context = TestContext::new_with_versions(&["3.13"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -3010,7 +3010,7 @@ fn install_transparent_patch_upgrade_uv_venv() {
|
||||
// minor version should point to the highest.
|
||||
#[test]
|
||||
fn install_multiple_patches() {
|
||||
let context = TestContext::new_with_versions(&[])
|
||||
let context = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -3101,7 +3101,7 @@ fn install_multiple_patches() {
|
||||
// next highest.
|
||||
#[test]
|
||||
fn uninstall_highest_patch() {
|
||||
let context = TestContext::new_with_versions(&[])
|
||||
let context = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -3175,7 +3175,7 @@ fn uninstall_highest_patch() {
|
||||
// installed.
|
||||
#[test]
|
||||
fn install_no_transparent_upgrade_with_venv_patch_specification() {
|
||||
let context = TestContext::new_with_versions(&["3.13"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -3245,7 +3245,7 @@ fn install_no_transparent_upgrade_with_venv_patch_specification() {
|
||||
// the latest patch version installed.
|
||||
#[test]
|
||||
fn install_transparent_patch_upgrade_venv_module() {
|
||||
let context = TestContext::new_with_versions(&[])
|
||||
let context = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -3323,7 +3323,7 @@ fn install_transparent_patch_upgrade_venv_module() {
|
||||
// `uv run` should not downgrade virtual environments.
|
||||
#[test]
|
||||
fn install_lower_patch_automatically() {
|
||||
let context = TestContext::new_with_versions(&[])
|
||||
let context = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -3393,7 +3393,7 @@ fn install_lower_patch_automatically() {
|
||||
|
||||
#[test]
|
||||
fn uninstall_last_patch() {
|
||||
let context = TestContext::new_with_versions(&[])
|
||||
let context = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
@@ -3480,7 +3480,7 @@ fn uninstall_last_patch() {
|
||||
fn python_install_pyodide() {
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_exe_suffix()
|
||||
.with_managed_python_dirs()
|
||||
.with_python_download_cache()
|
||||
@@ -3651,7 +3651,7 @@ fn python_install_pyodide() {
|
||||
fn python_install_build_version() {
|
||||
use uv_python::managed::platform_key_from_env;
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_managed_python_dirs()
|
||||
.with_python_download_cache()
|
||||
@@ -3734,7 +3734,7 @@ fn python_install_build_version() {
|
||||
fn python_install_build_version_pypy() {
|
||||
use uv_python::managed::platform_key_from_env;
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_python_sources()
|
||||
.with_managed_python_dirs()
|
||||
@@ -3803,7 +3803,7 @@ fn python_install_build_version_pypy() {
|
||||
|
||||
#[test]
|
||||
fn python_install_upgrade() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -3930,7 +3930,7 @@ fn python_install_upgrade() {
|
||||
|
||||
#[test]
|
||||
fn python_install_upgrade_version_file() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -3979,7 +3979,7 @@ fn python_install_upgrade_version_file() {
|
||||
|
||||
#[test]
|
||||
fn python_install_armv7() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_managed_python_dirs()
|
||||
.with_python_download_cache()
|
||||
@@ -4025,7 +4025,7 @@ fn python_install_compile_bytecode() -> anyhow::Result<()> {
|
||||
Ok(count)
|
||||
}
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_compiled_file_count()
|
||||
@@ -4099,7 +4099,7 @@ fn python_install_compile_bytecode() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn python_install_compile_bytecode_existing() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_compiled_file_count()
|
||||
@@ -4132,7 +4132,7 @@ fn python_install_compile_bytecode_existing() {
|
||||
|
||||
#[test]
|
||||
fn python_install_compile_bytecode_upgrade() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_compiled_file_count()
|
||||
@@ -4166,7 +4166,7 @@ fn python_install_compile_bytecode_upgrade() {
|
||||
|
||||
#[test]
|
||||
fn python_install_upgrade_build_version() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -4225,7 +4225,7 @@ fn python_install_upgrade_build_version() {
|
||||
|
||||
#[test]
|
||||
fn python_install_compile_bytecode_multiple() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_compiled_file_count()
|
||||
@@ -4251,7 +4251,7 @@ fn python_install_compile_bytecode_multiple() {
|
||||
#[cfg(unix)] // Pyodide cannot be used on Windows
|
||||
#[test]
|
||||
fn python_install_compile_bytecode_pyodide() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_compiled_file_count()
|
||||
@@ -4279,7 +4279,7 @@ fn python_install_compile_bytecode_pyodide() {
|
||||
|
||||
#[test]
|
||||
fn python_install_compile_bytecode_graalpy() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_compiled_file_count()
|
||||
@@ -4302,7 +4302,7 @@ fn python_install_compile_bytecode_graalpy() {
|
||||
|
||||
#[test]
|
||||
fn python_install_compile_bytecode_pypy() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_filtered_compiled_file_count()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use uv_platform::{Arch, Os};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use anyhow::Result;
|
||||
use uv_test::{TestContext, uv_snapshot};
|
||||
use wiremock::{
|
||||
Mock, MockServer, ResponseTemplate,
|
||||
matchers::{method, path},
|
||||
@@ -10,7 +10,7 @@ use wiremock::{
|
||||
|
||||
#[test]
|
||||
fn python_list() {
|
||||
let mut context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let mut context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_python_symlinks()
|
||||
.with_filtered_python_keys()
|
||||
.with_collapsed_whitespace();
|
||||
@@ -133,7 +133,7 @@ fn python_list() {
|
||||
|
||||
#[test]
|
||||
fn python_list_pin() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_python_symlinks()
|
||||
.with_filtered_python_keys()
|
||||
.with_collapsed_whitespace();
|
||||
@@ -173,7 +173,7 @@ fn python_list_pin() {
|
||||
|
||||
#[test]
|
||||
fn python_list_venv() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_python_symlinks()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -216,7 +216,7 @@ fn python_list_venv() {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn python_list_unsupported_version() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.12"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.12"])
|
||||
.with_filtered_python_symlinks()
|
||||
.with_filtered_python_keys();
|
||||
|
||||
@@ -291,7 +291,7 @@ fn python_list_unsupported_version() {
|
||||
|
||||
#[test]
|
||||
fn python_list_duplicate_path_entries() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_python_symlinks()
|
||||
.with_filtered_python_keys()
|
||||
.with_collapsed_whitespace();
|
||||
@@ -360,7 +360,8 @@ fn python_list_duplicate_path_entries() {
|
||||
|
||||
#[test]
|
||||
fn python_list_downloads() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[]).with_filtered_python_keys();
|
||||
let context: TestContext =
|
||||
uv_test::test_context_with_versions!(&[]).with_filtered_python_keys();
|
||||
|
||||
// We do not test showing all interpreters — as it differs per platform
|
||||
// Instead, we choose a Python version where our available distributions are stable
|
||||
@@ -415,7 +416,7 @@ fn python_list_downloads() {
|
||||
fn python_list_downloads_installed() {
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_python_install_bin()
|
||||
.with_filtered_python_names()
|
||||
@@ -487,7 +488,7 @@ fn python_list_downloads_installed() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn python_list_remote_python_downloads_json_url() -> Result<()> {
|
||||
let context: TestContext = TestContext::new_with_versions(&[]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[]);
|
||||
let server = MockServer::start().await;
|
||||
|
||||
let remote_json = r#"
|
||||
@@ -592,7 +593,7 @@ async fn python_list_remote_python_downloads_json_url() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn python_list_with_mirrors() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_python_keys()
|
||||
.with_collapsed_whitespace()
|
||||
// Add filters to normalize file paths in URLs
|
||||
|
||||
@@ -5,7 +5,7 @@ use indoc::{formatdoc, indoc};
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, site_packages_path, uv_snapshot};
|
||||
use uv_test::{site_packages_path, uv_snapshot};
|
||||
|
||||
/// Filter the user scheme, which differs between Windows and Unix.
|
||||
fn user_scheme_bin_filter() -> (String, String) {
|
||||
@@ -32,7 +32,7 @@ print(uv.find_uv_bin())
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_venv() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -72,7 +72,7 @@ fn find_uv_bin_venv() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_target() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -116,7 +116,7 @@ fn find_uv_bin_target() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_prefix() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -165,7 +165,7 @@ fn find_uv_bin_prefix() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_base_prefix() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -216,7 +216,7 @@ fn find_uv_bin_base_prefix() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_in_ephemeral_environment() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -263,7 +263,7 @@ fn find_uv_bin_in_ephemeral_environment() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_in_parent_of_ephemeral_environment() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -320,7 +320,7 @@ fn find_uv_bin_in_parent_of_ephemeral_environment() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_user_bin() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -396,7 +396,7 @@ fn find_uv_bin_user_bin() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_error_message() {
|
||||
let mut context = TestContext::new("3.12")
|
||||
let mut context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -475,7 +475,7 @@ fn find_uv_bin_error_message() {
|
||||
#[cfg(feature = "test-python-eol")]
|
||||
#[test]
|
||||
fn find_uv_bin_py38() {
|
||||
let context = TestContext::new("3.8")
|
||||
let context = uv_test::test_context!("3.8")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -515,7 +515,7 @@ fn find_uv_bin_py38() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_py39() {
|
||||
let context = TestContext::new("3.9")
|
||||
let context = uv_test::test_context!("3.9")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -555,7 +555,7 @@ fn find_uv_bin_py39() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_py310() {
|
||||
let context = TestContext::new("3.10")
|
||||
let context = uv_test::test_context!("3.10")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -595,7 +595,7 @@ fn find_uv_bin_py310() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_py311() {
|
||||
let context = TestContext::new("3.11")
|
||||
let context = uv_test::test_context!("3.11")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -635,7 +635,7 @@ fn find_uv_bin_py311() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_py312() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -675,7 +675,7 @@ fn find_uv_bin_py312() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_py313() {
|
||||
let context = TestContext::new("3.13")
|
||||
let context = uv_test::test_context!("3.13")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -715,7 +715,7 @@ fn find_uv_bin_py313() {
|
||||
|
||||
#[test]
|
||||
fn find_uv_bin_py314() {
|
||||
let context = TestContext::new("3.14")
|
||||
let context = uv_test::test_context!("3.14")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::{FileWriteStr, PathChild, PathCreateDir};
|
||||
@@ -8,10 +7,11 @@ use insta::assert_snapshot;
|
||||
use uv_platform::{Arch, Os};
|
||||
use uv_python::{PYTHON_VERSION_FILENAME, PYTHON_VERSIONS_FILENAME};
|
||||
use uv_static::EnvVars;
|
||||
use uv_test::{TestContext, uv_snapshot};
|
||||
|
||||
#[test]
|
||||
fn python_pin() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
|
||||
// Without arguments, we attempt to read the current pin (which does not exist yet)
|
||||
uv_snapshot!(context.filters(), context.python_pin(), @"
|
||||
@@ -185,7 +185,7 @@ fn python_pin() {
|
||||
// If there is no project-level `.python-version` file, respect the global pin.
|
||||
#[test]
|
||||
fn python_pin_global_if_no_local() -> Result<()> {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
let uv = context.user_config_dir.child("uv");
|
||||
uv.create_dir_all()?;
|
||||
|
||||
@@ -226,7 +226,7 @@ fn python_pin_global_if_no_local() -> Result<()> {
|
||||
// the global pin.
|
||||
#[test]
|
||||
fn python_pin_global_use_local_if_available() -> Result<()> {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
let uv = context.user_config_dir.child("uv");
|
||||
uv.create_dir_all()?;
|
||||
|
||||
@@ -306,7 +306,7 @@ fn python_pin_global_use_local_if_available() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn python_pin_global_creates_parent_dirs() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
let uv_global_config_dir = context.user_config_dir.child("uv");
|
||||
|
||||
assert!(
|
||||
@@ -334,7 +334,7 @@ fn python_pin_global_creates_parent_dirs() {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn python_pin_no_python() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.python_pin().arg("3.12"), @"
|
||||
success: true
|
||||
@@ -350,7 +350,7 @@ fn python_pin_no_python() {
|
||||
#[test]
|
||||
fn python_pin_compatible_with_requires_python() -> Result<()> {
|
||||
let context: TestContext =
|
||||
TestContext::new_with_versions(&["3.10", "3.11"]).with_filtered_python_sources();
|
||||
uv_test::test_context_with_versions!(&["3.10", "3.11"]).with_filtered_python_sources();
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -518,7 +518,7 @@ fn python_pin_compatible_with_requires_python() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn warning_pinned_python_version_not_installed() -> Result<()> {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.10", "3.11"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.10", "3.11"]);
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
@@ -560,7 +560,8 @@ fn warning_pinned_python_version_not_installed() -> Result<()> {
|
||||
/// We do need a Python interpreter for `--resolved` pins
|
||||
#[test]
|
||||
fn python_pin_resolve_no_python() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[]).with_filtered_python_sources();
|
||||
let context: TestContext =
|
||||
uv_test::test_context_with_versions!(&[]).with_filtered_python_sources();
|
||||
uv_snapshot!(context.filters(), context.python_pin().arg("--resolved").arg("3.12"), @"
|
||||
success: false
|
||||
exit_code: 2
|
||||
@@ -575,7 +576,7 @@ fn python_pin_resolve_no_python() {
|
||||
|
||||
#[test]
|
||||
fn python_pin_resolve() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.12", "3.13"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.12", "3.13"]);
|
||||
|
||||
// We pin the first interpreter on the path
|
||||
uv_snapshot!(context.filters(), context.python_pin().arg("--resolved").arg("any"), @"
|
||||
@@ -744,7 +745,7 @@ fn python_pin_resolve() {
|
||||
|
||||
#[test]
|
||||
fn python_pin_with_comments() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
let context = uv_test::test_context_with_versions!(&[]);
|
||||
|
||||
let content = indoc::indoc! {r"
|
||||
3.12
|
||||
@@ -784,7 +785,8 @@ fn python_pin_with_comments() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-python-managed")]
|
||||
fn python_pin_install() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[]).with_filtered_python_sources();
|
||||
let context: TestContext =
|
||||
uv_test::test_context_with_versions!(&[]).with_filtered_python_sources();
|
||||
|
||||
// Should not install 3.12 when downloads are not automatic
|
||||
uv_snapshot!(context.filters(), context.python_pin().arg("3.12"), @"
|
||||
@@ -809,7 +811,7 @@ fn python_pin_install() {
|
||||
|
||||
#[test]
|
||||
fn python_pin_rm() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.12"]);
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.python_pin().arg("--rm"), @"
|
||||
success: false
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::FileTouch;
|
||||
use assert_fs::prelude::PathChild;
|
||||
use uv_python::managed::platform_key_from_env;
|
||||
use uv_static::EnvVars;
|
||||
use uv_test::{TestContext, uv_snapshot};
|
||||
|
||||
#[test]
|
||||
fn python_upgrade() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -93,7 +93,7 @@ fn python_upgrade() {
|
||||
|
||||
#[test]
|
||||
fn python_upgrade_without_version() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -162,7 +162,7 @@ fn python_upgrade_without_version() {
|
||||
|
||||
#[test]
|
||||
fn python_upgrade_transparent_from_venv() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.13"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -265,7 +265,7 @@ fn python_upgrade_transparent_from_venv() {
|
||||
// upgrading.
|
||||
#[test]
|
||||
fn python_upgrade_transparent_from_venv_preview() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.13"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -329,7 +329,7 @@ fn python_upgrade_transparent_from_venv_preview() {
|
||||
|
||||
#[test]
|
||||
fn python_upgrade_ignored_with_python_pin() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.13"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -395,7 +395,7 @@ fn python_upgrade_ignored_with_python_pin() {
|
||||
// prevent transparent upgrades.
|
||||
#[test]
|
||||
fn python_no_transparent_upgrade_with_venv_patch_specification() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.13"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -461,7 +461,7 @@ fn python_no_transparent_upgrade_with_venv_patch_specification() {
|
||||
// virtual environments.
|
||||
#[test]
|
||||
fn python_transparent_upgrade_venv_venv() {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.13"])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -555,7 +555,7 @@ fn python_transparent_upgrade_venv_venv() {
|
||||
// the `venv` module.
|
||||
#[test]
|
||||
fn python_upgrade_transparent_from_venv_module() {
|
||||
let context = TestContext::new_with_versions(&["3.13"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -623,7 +623,7 @@ fn python_upgrade_transparent_from_venv_module() {
|
||||
// the `venv` module within an existing virtual environment.
|
||||
#[test]
|
||||
fn python_upgrade_transparent_from_venv_module_in_venv() {
|
||||
let context = TestContext::new_with_versions(&["3.13"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -711,7 +711,7 @@ fn python_upgrade_transparent_from_venv_module_in_venv() {
|
||||
// interpreter.
|
||||
#[test]
|
||||
fn python_upgrade_force_install() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.13"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.13"])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -751,7 +751,7 @@ fn python_upgrade_force_install() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn python_upgrade_implementation() {
|
||||
let context = TestContext::new_with_versions(&[])
|
||||
let context = uv_test::test_context_with_versions!(&[])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
@@ -774,7 +774,7 @@ fn python_upgrade_implementation() {
|
||||
|
||||
#[test]
|
||||
fn python_upgrade_build_version() {
|
||||
let context: TestContext = TestContext::new_with_versions(&[])
|
||||
let context: TestContext = uv_test::test_context_with_versions!(&[])
|
||||
.with_python_download_cache()
|
||||
.with_filtered_python_keys()
|
||||
.with_filtered_exe_suffix()
|
||||
|
||||
+90
-90
@@ -11,11 +11,11 @@ use uv_fs::copy_dir_all;
|
||||
use uv_python::PYTHON_VERSION_FILENAME;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::{TestContext, uv_snapshot};
|
||||
|
||||
#[test]
|
||||
fn run_with_python_version() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12", "3.11", "3.9"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12", "3.11", "3.9"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -141,7 +141,7 @@ fn run_with_python_version() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_args() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let mut filters = context.filters();
|
||||
filters.push((r"Usage: (uv|\.exe) run \[OPTIONS\] (?s).*", "[UV RUN HELP]"));
|
||||
@@ -199,7 +199,7 @@ fn run_args() -> Result<()> {
|
||||
/// This should list the available scripts.
|
||||
#[test]
|
||||
fn run_no_args() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -267,7 +267,7 @@ fn run_no_args() -> Result<()> {
|
||||
/// dependencies.
|
||||
#[test]
|
||||
fn run_pep723_script() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -475,7 +475,7 @@ fn run_pep723_script() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_pep723_script_requires_python() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.9", "3.11"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.9", "3.11"]);
|
||||
|
||||
// If we have a `.python-version` that's incompatible with the script, we should error.
|
||||
let python_version = context.temp_dir.child(PYTHON_VERSION_FILENAME);
|
||||
@@ -536,7 +536,7 @@ fn run_pep723_script_requires_python() -> Result<()> {
|
||||
/// Run a `.pyw` script. The script should be executed with `pythonw.exe`.
|
||||
#[test]
|
||||
fn run_pythonw_script() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -580,7 +580,7 @@ fn run_pythonw_script() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn run_pep723_script_metadata() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// If the script contains a PEP 723 tag, we should install its requirements.
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
@@ -648,7 +648,7 @@ fn run_pep723_script_metadata() -> Result<()> {
|
||||
/// Run a PEP 723-compatible script with a `[[tool.uv.index]]`.
|
||||
#[test]
|
||||
fn run_pep723_script_index() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -689,7 +689,7 @@ fn run_pep723_script_index() -> Result<()> {
|
||||
/// Run a PEP 723-compatible script with `tool.uv` constraints.
|
||||
#[test]
|
||||
fn run_pep723_script_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -727,7 +727,7 @@ fn run_pep723_script_constraints() -> Result<()> {
|
||||
/// Run a PEP 723-compatible script with `tool.uv` overrides.
|
||||
#[test]
|
||||
fn run_pep723_script_overrides() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -765,7 +765,7 @@ fn run_pep723_script_overrides() -> Result<()> {
|
||||
/// Run a PEP 723-compatible script with `tool.uv` build constraints.
|
||||
#[test]
|
||||
fn run_pep723_script_build_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
|
||||
@@ -838,7 +838,7 @@ fn run_pep723_script_build_constraints() -> Result<()> {
|
||||
/// Run a PEP 723-compatible script with a lockfile.
|
||||
#[test]
|
||||
fn run_pep723_script_lock() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -1046,7 +1046,7 @@ fn run_pep723_script_lock() -> Result<()> {
|
||||
/// With `managed = false`, we should avoid installing the project itself.
|
||||
#[test]
|
||||
fn run_managed_false() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -1079,7 +1079,7 @@ fn run_managed_false() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_exact() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -1148,7 +1148,7 @@ fn run_exact() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -1276,7 +1276,7 @@ fn run_with() -> Result<()> {
|
||||
/// search paths are available in these ephemeral environments.
|
||||
#[test]
|
||||
fn run_with_pyvenv_cfg_file() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_pyvenv_cfg_filters();
|
||||
let context = uv_test::test_context!("3.12").with_pyvenv_cfg_filters();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -1328,7 +1328,7 @@ fn run_with_pyvenv_cfg_file() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_overlay_interpreter() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -1577,7 +1577,7 @@ fn run_with_overlay_interpreter() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_build_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.9");
|
||||
let context = uv_test::test_context!("3.9");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -1652,7 +1652,7 @@ fn run_with_build_constraints() -> Result<()> {
|
||||
/// Sync all members in a workspace.
|
||||
#[test]
|
||||
fn run_in_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1814,7 +1814,7 @@ fn run_in_workspace() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let anyio_local = context.temp_dir.child("src").child("anyio_local");
|
||||
copy_dir_all(
|
||||
@@ -1962,7 +1962,7 @@ fn run_with_editable() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_group() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2155,7 +2155,7 @@ fn run_group() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_locked() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2319,7 +2319,7 @@ fn run_locked() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_frozen() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2384,7 +2384,7 @@ fn run_frozen() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_no_sync() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2443,7 +2443,7 @@ fn run_no_sync() -> Result<()> {
|
||||
/// See: <https://github.com/astral-sh/uv/issues/17390>
|
||||
#[test]
|
||||
fn run_no_sync_env_var() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2499,7 +2499,7 @@ fn run_no_sync_env_var() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_empty_requirements_txt() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -2559,7 +2559,7 @@ fn run_empty_requirements_txt() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_requirements_txt() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -2709,7 +2709,7 @@ fn run_requirements_txt() -> Result<()> {
|
||||
/// Ignore and warn when (e.g.) the `--index-url` argument is a provided `requirements.txt`.
|
||||
#[test]
|
||||
fn run_requirements_txt_arguments() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -2763,7 +2763,7 @@ fn run_requirements_txt_arguments() -> Result<()> {
|
||||
/// Ensure that we can import from the root project when layering `--with` requirements.
|
||||
#[test]
|
||||
fn run_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -2816,7 +2816,7 @@ fn run_editable() -> Result<()> {
|
||||
#[test]
|
||||
fn run_from_directory() -> Result<()> {
|
||||
// Default to 3.11 so that the `.python-version` is meaningful.
|
||||
let context = TestContext::new_with_versions(&["3.10", "3.11", "3.12"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.10", "3.11", "3.12"])
|
||||
.with_filtered_missing_file_error();
|
||||
|
||||
let project_dir = context.temp_dir.child("project");
|
||||
@@ -2995,7 +2995,7 @@ fn run_from_directory() -> Result<()> {
|
||||
/// By default, omit resolver and installer output.
|
||||
#[test]
|
||||
fn run_without_output() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -3043,7 +3043,7 @@ fn run_without_output() -> Result<()> {
|
||||
/// Ensure that we can import from the root project when layering `--with` requirements.
|
||||
#[test]
|
||||
fn run_isolated_python_version() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.9", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.9", "3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -3137,7 +3137,7 @@ fn run_isolated_python_version() -> Result<()> {
|
||||
/// Ignore the existing project when executing with `--no-project`.
|
||||
#[test]
|
||||
fn run_no_project() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -3227,7 +3227,7 @@ fn run_no_project() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_stdin() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -3251,7 +3251,7 @@ fn run_stdin() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let main_script = context.temp_dir.child("__main__.py");
|
||||
main_script.write_str(indoc! { r#"
|
||||
@@ -3273,7 +3273,7 @@ fn run_package() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_zipapp() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a zipapp.
|
||||
let child = context.temp_dir.child("app");
|
||||
@@ -3312,7 +3312,7 @@ fn run_zipapp() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_stdin_args() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.run().arg("python").arg("-c").arg("import sys; print(sys.argv)").arg("foo").arg("bar"), @"
|
||||
success: true
|
||||
@@ -3327,7 +3327,7 @@ fn run_stdin_args() {
|
||||
/// Run a module equivalent to `python -m foo`.
|
||||
#[test]
|
||||
fn run_module() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.run().arg("-m").arg("__hello__"), @"
|
||||
success: true
|
||||
@@ -3363,7 +3363,7 @@ fn run_module() {
|
||||
|
||||
#[test]
|
||||
fn run_module_stdin() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.run().arg("-m").arg("-"), @"
|
||||
success: false
|
||||
@@ -3378,7 +3378,7 @@ fn run_module_stdin() {
|
||||
/// Test for how run reacts to a pyproject.toml without a `[project]`
|
||||
#[test]
|
||||
fn virtual_empty() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -3421,7 +3421,7 @@ fn virtual_empty() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_isolated_incompatible_python() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.9", "3.11"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.9", "3.11"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -3477,7 +3477,7 @@ fn run_isolated_incompatible_python() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_isolated_does_not_modify_lock() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -3580,7 +3580,7 @@ fn run_isolated_does_not_modify_lock() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_isolated_with_frozen() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -3648,7 +3648,7 @@ fn run_isolated_with_frozen() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_compiled_python_file() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a non-PEP 723 script.
|
||||
let test_non_script = context.temp_dir.child("main.py");
|
||||
@@ -3749,7 +3749,7 @@ fn run_compiled_python_file() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_exit_code() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("script.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -3768,7 +3768,7 @@ fn run_exit_code() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_invalid_project_table() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -3807,7 +3807,7 @@ fn run_invalid_project_table() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(target_family = "unix")]
|
||||
fn run_script_without_build_system() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -3848,7 +3848,7 @@ fn run_script_without_build_system() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_script_module_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -3934,7 +3934,7 @@ fn run_script_module_conflict() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_script_explicit() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("script");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -3967,7 +3967,7 @@ fn run_script_explicit() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_script_explicit_stdin() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("script");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -4000,7 +4000,7 @@ fn run_script_explicit_stdin() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_script_explicit_no_file() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context
|
||||
.run()
|
||||
.arg("--script")
|
||||
@@ -4013,7 +4013,7 @@ fn run_script_explicit_no_file() {
|
||||
#[cfg(target_family = "unix")]
|
||||
#[test]
|
||||
fn run_script_explicit_directory() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
fs_err::create_dir(context.temp_dir.child("script"))?;
|
||||
|
||||
@@ -4032,7 +4032,7 @@ fn run_script_explicit_directory() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn run_gui_script_explicit_windows() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("script");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -4066,7 +4066,7 @@ fn run_gui_script_explicit_windows() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn run_gui_script_explicit_stdin_windows() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("script");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -4100,7 +4100,7 @@ fn run_gui_script_explicit_stdin_windows() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn run_gui_script_explicit_unix() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let test_script = context.temp_dir.child("script");
|
||||
test_script.write_str(indoc! { r#"
|
||||
# /// script
|
||||
@@ -4131,7 +4131,7 @@ fn run_gui_script_explicit_unix() -> Result<()> {
|
||||
fn run_linked_environment_path() -> Result<()> {
|
||||
use anyhow::Ok;
|
||||
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_python_names();
|
||||
|
||||
@@ -4210,7 +4210,7 @@ fn run_linked_environment_path() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_active_project_environment() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_python_names();
|
||||
|
||||
@@ -4317,7 +4317,7 @@ fn run_active_project_environment() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_active_script_environment() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_python_names();
|
||||
|
||||
@@ -4418,7 +4418,7 @@ fn run_active_script_environment() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn run_gui_script_explicit_stdin_unix() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("script");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -4451,7 +4451,7 @@ fn run_gui_script_explicit_stdin_unix() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_remote_pep723_script() {
|
||||
let context = TestContext::new("3.12").with_filtered_python_names();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_python_names();
|
||||
let mut filters = context.filters();
|
||||
filters.push((
|
||||
r"(?m)^Downloaded remote script to:.*\.py$",
|
||||
@@ -4477,7 +4477,7 @@ fn run_remote_pep723_script() {
|
||||
#[cfg(unix)] // A URL could be a valid filepath on Unix but not on Windows
|
||||
#[test]
|
||||
fn run_url_like_with_local_file_priority() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let url = "https://example.com/path/to/main.py";
|
||||
let local_path: std::path::PathBuf = ["https:", "", "example.com", "path", "to", "main.py"]
|
||||
@@ -4505,7 +4505,7 @@ fn run_url_like_with_local_file_priority() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_stdin_with_pep723() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -4538,7 +4538,7 @@ fn run_stdin_with_pep723() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_env() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.temp_dir.child("test.py").write_str(indoc! { "
|
||||
import os
|
||||
@@ -4586,7 +4586,7 @@ fn run_with_env() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_env_file() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.temp_dir.child("test.py").write_str(indoc! { "
|
||||
import os
|
||||
@@ -4622,7 +4622,7 @@ fn run_with_env_file() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_multiple_env_files() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.temp_dir.child("test.py").write_str(indoc! { "
|
||||
import os
|
||||
@@ -4672,7 +4672,7 @@ fn run_with_multiple_env_files() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_env_omitted() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.temp_dir.child("test.py").write_str(indoc! { "
|
||||
import os
|
||||
@@ -4699,7 +4699,7 @@ fn run_with_env_omitted() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_malformed_env() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.temp_dir.child("test.py").write_str(indoc! { "
|
||||
import os
|
||||
@@ -4727,7 +4727,7 @@ fn run_with_malformed_env() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_not_existing_env_file() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.temp_dir.child("test.py").write_str(indoc! { "
|
||||
import os
|
||||
@@ -4755,7 +4755,7 @@ fn run_with_not_existing_env_file() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_extra_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -4801,7 +4801,7 @@ fn run_with_extra_conflict() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_with_group_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -4847,7 +4847,7 @@ fn run_with_group_conflict() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_default_groups() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5079,8 +5079,8 @@ fn run_default_groups() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_groups_requires_python() -> Result<()> {
|
||||
let context =
|
||||
TestContext::new_with_versions(&["3.11", "3.12", "3.13"]).with_filtered_python_sources();
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12", "3.13"])
|
||||
.with_filtered_python_sources();
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5238,7 +5238,7 @@ fn run_groups_requires_python() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_groups_include_requires_python() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12", "3.13"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12", "3.13"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -5338,7 +5338,7 @@ fn run_groups_include_requires_python() -> Result<()> {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn exit_status_signal() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let script = context.temp_dir.child("segfault.py");
|
||||
script.write_str(indoc! {r"
|
||||
@@ -5352,7 +5352,7 @@ fn exit_status_signal() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_repeated() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.13", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.13", "3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -5422,7 +5422,7 @@ fn run_repeated() -> Result<()> {
|
||||
/// See: <https://github.com/astral-sh/uv/issues/11117>
|
||||
#[test]
|
||||
fn run_without_overlay() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.13"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.13"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -5493,18 +5493,18 @@ fn run_without_overlay() -> Result<()> {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn detect_infinite_recursion() -> Result<()> {
|
||||
use crate::common::get_bin;
|
||||
use indoc::formatdoc;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use uv_test::get_bin;
|
||||
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main");
|
||||
test_script.write_str(&formatdoc! { r#"
|
||||
#!{uv} run
|
||||
|
||||
print("Hello, world!")
|
||||
"#, uv = get_bin().display() })?;
|
||||
"#, uv = get_bin!().display() })?;
|
||||
|
||||
fs_err::set_permissions(test_script.path(), PermissionsExt::from_mode(0o0744))?;
|
||||
|
||||
@@ -5530,7 +5530,7 @@ fn detect_infinite_recursion() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_uv_variable() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Display the `UV` variable
|
||||
uv_snapshot!(
|
||||
@@ -5551,7 +5551,7 @@ fn run_uv_variable() {
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn run_windows_legacy_scripts() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
|
||||
@@ -5782,7 +5782,7 @@ fn run_windows_legacy_scripts() -> Result<()> {
|
||||
/// See: <https://github.com/astral-sh/uv/issues/13173>
|
||||
#[test]
|
||||
fn run_pep723_script_with_constraints_lock() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -5877,7 +5877,7 @@ fn run_pep723_script_with_constraints_lock() -> Result<()> {
|
||||
/// See: <https://github.com/astral-sh/uv/issues/13173>
|
||||
#[test]
|
||||
fn run_pep723_script_with_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let test_script = context.temp_dir.child("main.py");
|
||||
test_script.write_str(indoc! { r#"
|
||||
@@ -5929,7 +5929,7 @@ fn run_pep723_script_with_constraints() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_no_sync_incompatible_python() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12", "3.11", "3.9"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12", "3.11", "3.9"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -5981,7 +5981,7 @@ fn run_no_sync_incompatible_python() -> Result<()> {
|
||||
#[test]
|
||||
fn run_python_preference_no_project() {
|
||||
let context =
|
||||
TestContext::new_with_versions(&["3.12", "3.11"]).with_versions_as_managed(&["3.12"]);
|
||||
uv_test::test_context_with_versions!(&["3.12", "3.11"]).with_versions_as_managed(&["3.12"]);
|
||||
|
||||
context.venv().assert().success();
|
||||
|
||||
@@ -6027,7 +6027,7 @@ fn run_python_preference_no_project() {
|
||||
/// Regression test for: <https://github.com/astral-sh/uv/issues/15518>
|
||||
#[test]
|
||||
fn isolate_child_environment() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r#"
|
||||
@@ -6107,7 +6107,7 @@ fn isolate_child_environment() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn run_only_group_and_extra_conflict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -6161,7 +6161,7 @@ fn run_only_group_and_extra_conflict() -> Result<()> {
|
||||
/// from the target's directory rather than the current working directory.
|
||||
#[test]
|
||||
fn run_target_workspace_discovery() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a workspace in a subdirectory.
|
||||
let workspace = context.temp_dir.child("project");
|
||||
|
||||
@@ -7,7 +7,7 @@ use axoupdater::{
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, get_bin, uv_snapshot};
|
||||
use uv_test::{get_bin, uv_snapshot};
|
||||
|
||||
#[test]
|
||||
fn check_self_update() {
|
||||
@@ -26,7 +26,7 @@ fn check_self_update() {
|
||||
app_name: "uv".to_owned(),
|
||||
package: "uv".to_owned(),
|
||||
owner: "astral-sh".to_owned(),
|
||||
bin: get_bin(),
|
||||
bin: get_bin!(),
|
||||
binaries: vec!["uv".to_owned()],
|
||||
args: vec!["self".to_owned(), "update".to_owned()],
|
||||
release_type: ReleaseSourceType::GitHub,
|
||||
@@ -45,7 +45,7 @@ fn check_self_update() {
|
||||
|
||||
#[test]
|
||||
fn test_self_update_offline_error() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.self_update().arg("--offline"),
|
||||
@r"
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::process::Command;
|
||||
use assert_fs::prelude::*;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
/// Add shared arguments to a command.
|
||||
///
|
||||
@@ -32,7 +32,7 @@ fn add_shared_args(mut command: Command) -> Command {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_uv_toml() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `uv.toml` file to the directory.
|
||||
let config = context.temp_dir.child("uv.toml");
|
||||
@@ -676,7 +676,7 @@ fn resolve_uv_toml() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_pyproject_toml() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `uv.toml` file to the directory.
|
||||
let config = context.temp_dir.child("uv.toml");
|
||||
@@ -1307,7 +1307,7 @@ fn resolve_pyproject_toml() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_index_url() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `pyproject.toml` file to the directory.
|
||||
let pyproject = context.temp_dir.child("pyproject.toml");
|
||||
@@ -1847,7 +1847,7 @@ fn resolve_index_url() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_find_links() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `pyproject.toml` file to the directory.
|
||||
let pyproject = context.temp_dir.child("pyproject.toml");
|
||||
@@ -2078,7 +2078,7 @@ fn resolve_find_links() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_top_level() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write out to the top-level (`tool.uv`, rather than `tool.uv.pip`).
|
||||
let pyproject = context.temp_dir.child("pyproject.toml");
|
||||
@@ -2777,7 +2777,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
||||
resolution = "lowest-direct"
|
||||
"#})?;
|
||||
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str("anyio>3.0.0")?;
|
||||
@@ -3512,7 +3512,7 @@ fn resolve_tool() -> anyhow::Result<()> {
|
||||
resolution = "lowest-direct"
|
||||
"#})?;
|
||||
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Add a local configuration to disable build isolation.
|
||||
let config = context.temp_dir.child("uv.toml");
|
||||
@@ -3693,7 +3693,7 @@ fn resolve_tool() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_poetry_toml() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `uv.toml` file to the directory.
|
||||
let config = context.temp_dir.child("pyproject.toml");
|
||||
@@ -3900,7 +3900,7 @@ fn resolve_poetry_toml() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_both() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `uv.toml` file to the directory.
|
||||
let config = context.temp_dir.child("uv.toml");
|
||||
@@ -4151,7 +4151,7 @@ fn resolve_both() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_both_special_fields() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `uv.toml` file to the directory.
|
||||
let config = context.temp_dir.child("uv.toml");
|
||||
@@ -4394,7 +4394,7 @@ fn resolve_both_special_fields() -> anyhow::Result<()> {
|
||||
/// Tests that errors when parsing `conflicts` are reported.
|
||||
#[test]
|
||||
fn invalid_conflicts() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject = context.temp_dir.child("pyproject.toml");
|
||||
|
||||
// Write in `pyproject.toml` schema and test the singleton case.
|
||||
@@ -4459,7 +4459,7 @@ fn invalid_conflicts() -> anyhow::Result<()> {
|
||||
/// Tests that valid `conflicts` are parsed okay.
|
||||
#[test]
|
||||
fn valid_conflicts() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let xdg = assert_fs::TempDir::new().expect("Failed to create temp dir");
|
||||
let pyproject = context.temp_dir.child("pyproject.toml");
|
||||
|
||||
@@ -4496,7 +4496,7 @@ fn valid_conflicts() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_config_file() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `uv.toml` to a temporary location. (Use the cache directory for convenience, since
|
||||
// it's already obfuscated in the fixtures.)
|
||||
@@ -4795,7 +4795,7 @@ fn resolve_config_file() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn resolve_skip_empty() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Set `lowest-direct` in a `uv.toml`.
|
||||
let config = context.temp_dir.child("uv.toml");
|
||||
@@ -5182,7 +5182,7 @@ fn resolve_skip_empty() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn allow_insecure_host() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let config = context.temp_dir.child("uv.toml");
|
||||
config.write_str(indoc::indoc! {r#"
|
||||
@@ -5383,7 +5383,7 @@ fn allow_insecure_host() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn index_priority() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let config = context.temp_dir.child("uv.toml");
|
||||
config.write_str(indoc::indoc! {r#"
|
||||
@@ -6866,7 +6866,7 @@ fn index_priority() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn verify_hashes() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str("anyio>3.0.0")?;
|
||||
@@ -7907,7 +7907,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn preview_features() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let cmd = || {
|
||||
let mut cmd = context.version();
|
||||
@@ -8692,7 +8692,7 @@ fn preview_features() {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn upgrade_pip_cli_config_interaction() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str("anyio>3.0.0")?;
|
||||
@@ -9832,7 +9832,7 @@ fn upgrade_pip_cli_config_interaction() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn upgrade_project_cli_config_interaction() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc::indoc! {r#"
|
||||
@@ -10623,7 +10623,7 @@ fn upgrade_project_cli_config_interaction() -> anyhow::Result<()> {
|
||||
ignore = "Configuration tests are not yet supported on Windows"
|
||||
)]
|
||||
fn build_isolation_override() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Write a `uv.toml` file to disable build isolation.
|
||||
let uv_toml = context.temp_dir.child("uv.toml");
|
||||
|
||||
+164
-164
File diff suppressed because it is too large
Load Diff
@@ -2,11 +2,11 @@ use assert_fs::fixture::PathChild;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn tool_dir() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -24,7 +24,7 @@ fn tool_dir() {
|
||||
|
||||
#[test]
|
||||
fn tool_dir_bin() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ use predicates::prelude::predicate;
|
||||
use uv_fs::copy_dir_all;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn tool_install() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -182,7 +182,7 @@ fn tool_install() {
|
||||
|
||||
#[test]
|
||||
fn tool_install_python_from_global_version_file() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12", "3.13"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12", "3.13"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -412,7 +412,7 @@ fn tool_install_python_from_global_version_file() {
|
||||
|
||||
#[test]
|
||||
fn tool_install_with_editable() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2025-01-18T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -452,7 +452,7 @@ fn tool_install_with_editable() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_install_with_compatible_build_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.9")
|
||||
let context = uv_test::test_context!("3.9")
|
||||
.with_exclude_newer("2024-05-04T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -522,7 +522,7 @@ fn tool_install_with_compatible_build_constraints() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_install_with_incompatible_build_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.9")
|
||||
let context = uv_test::test_context!("3.9")
|
||||
.with_exclude_newer("2024-05-04T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -563,7 +563,7 @@ fn tool_install_with_incompatible_build_constraints() -> Result<()> {
|
||||
#[test]
|
||||
fn tool_install_suggest_other_packages_with_executable() {
|
||||
// FastAPI 0.111 is only available from this date onwards.
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2024-05-04T00:00:00Z")
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -627,7 +627,7 @@ fn tool_install_suggest_other_packages_with_executable() {
|
||||
/// Test installing a tool at a version
|
||||
#[test]
|
||||
fn tool_install_version() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -715,7 +715,7 @@ fn tool_install_version() {
|
||||
/// Test an editable installation of a tool.
|
||||
#[test]
|
||||
fn tool_install_editable() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -873,7 +873,7 @@ fn tool_install_editable() {
|
||||
/// Ensure that we remove any existing entrypoints upon error.
|
||||
#[test]
|
||||
fn tool_install_remove_on_empty() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1014,7 +1014,7 @@ fn tool_install_remove_on_empty() -> Result<()> {
|
||||
/// Test an editable installation of a tool using `--from`.
|
||||
#[test]
|
||||
fn tool_install_editable_from() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1098,7 +1098,7 @@ fn tool_install_editable_from() {
|
||||
/// Test installing a tool with `uv tool install --from`
|
||||
#[test]
|
||||
fn tool_install_from() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1163,7 +1163,7 @@ fn tool_install_from() {
|
||||
/// Test installing and reinstalling an already installed tool
|
||||
#[test]
|
||||
fn tool_install_already_installed() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -1348,7 +1348,7 @@ fn tool_install_already_installed() {
|
||||
/// Test installing a tool when its entry point already exists
|
||||
#[test]
|
||||
fn tool_install_force() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -1620,7 +1620,7 @@ fn tool_install_force() {
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn tool_install_home() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
|
||||
// Install `black`
|
||||
@@ -1662,7 +1662,7 @@ fn tool_install_home() {
|
||||
/// Test `uv tool install` when the bin directory is inferred from `$XDG_DATA_HOME`
|
||||
#[test]
|
||||
fn tool_install_xdg_data_home() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let data_home = context.temp_dir.child("data/home");
|
||||
let bin_dir = context.temp_dir.child("data/bin");
|
||||
@@ -1699,7 +1699,7 @@ fn tool_install_xdg_data_home() {
|
||||
/// Test `uv tool install` when the bin directory is set by `$XDG_BIN_HOME`
|
||||
#[test]
|
||||
fn tool_install_xdg_bin_home() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1734,7 +1734,7 @@ fn tool_install_xdg_bin_home() {
|
||||
/// Test `uv tool install` when the bin directory is set by `$UV_TOOL_BIN_DIR`
|
||||
#[test]
|
||||
fn tool_install_tool_bin_dir() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1769,7 +1769,7 @@ fn tool_install_tool_bin_dir() {
|
||||
/// Test installing a tool that lacks entrypoints
|
||||
#[test]
|
||||
fn tool_install_no_entrypoints() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1803,7 +1803,7 @@ fn tool_install_no_entrypoints() {
|
||||
/// Test installing a package that can't be installed.
|
||||
#[test]
|
||||
fn tool_install_uninstallable() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1858,7 +1858,7 @@ fn tool_install_uninstallable() {
|
||||
/// Test installing a tool with a bare URL requirement.
|
||||
#[test]
|
||||
fn tool_install_unnamed_package() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1947,7 +1947,7 @@ fn tool_install_unnamed_package() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn tool_install_git() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
let mut paths = BTreeSet::new();
|
||||
@@ -2042,7 +2042,7 @@ fn tool_install_git() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git-lfs")]
|
||||
fn tool_install_git_lfs() {
|
||||
let context = TestContext::new("3.13")
|
||||
let context = uv_test::test_context!("3.13")
|
||||
.with_filtered_exe_suffix()
|
||||
.with_git_lfs_config();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -2238,7 +2238,7 @@ fn tool_install_git_lfs() {
|
||||
/// name conflict.
|
||||
#[test]
|
||||
fn tool_install_unnamed_conflict() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2262,7 +2262,7 @@ fn tool_install_unnamed_conflict() {
|
||||
/// Test installing a tool with a bare URL requirement using `--from`.
|
||||
#[test]
|
||||
fn tool_install_unnamed_from() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2352,7 +2352,7 @@ fn tool_install_unnamed_from() {
|
||||
/// Test installing a tool with a bare URL requirement using `--with`.
|
||||
#[test]
|
||||
fn tool_install_unnamed_with() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2445,7 +2445,7 @@ fn tool_install_unnamed_with() {
|
||||
|
||||
#[test]
|
||||
fn tool_install_with_dependencies_from_script() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -2571,7 +2571,7 @@ fn tool_install_with_dependencies_from_script() -> Result<()> {
|
||||
/// Test installing a tool with additional requirements from a `requirements.txt` file.
|
||||
#[test]
|
||||
fn tool_install_requirements_txt() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -2675,7 +2675,7 @@ fn tool_install_requirements_txt() {
|
||||
/// Ignore and warn when (e.g.) the `--index-url` argument is a provided `requirements.txt`.
|
||||
#[test]
|
||||
fn tool_install_requirements_txt_arguments() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2803,7 +2803,7 @@ fn tool_install_requirements_txt_arguments() {
|
||||
/// Test upgrading an already installed tool.
|
||||
#[test]
|
||||
fn tool_install_upgrade() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -2967,7 +2967,7 @@ fn tool_install_upgrade() {
|
||||
/// Test reinstalling tools with varying `--python` requests.
|
||||
#[test]
|
||||
fn tool_install_python_requests() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3046,7 +3046,7 @@ fn tool_install_python_requests() {
|
||||
#[ignore = "https://github.com/astral-sh/uv/issues/7473"]
|
||||
#[test]
|
||||
fn tool_install_python_preference() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3188,7 +3188,7 @@ fn tool_install_python_preference() {
|
||||
/// Test preserving a tool environment when new but incompatible requirements are requested.
|
||||
#[test]
|
||||
fn tool_install_preserve_environment() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3254,7 +3254,7 @@ fn tool_install_preserve_environment() {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn tool_install_warn_path() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3288,7 +3288,7 @@ fn tool_install_warn_path() {
|
||||
/// Test installing and reinstalling with an invalid receipt.
|
||||
#[test]
|
||||
fn tool_install_bad_receipt() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3358,7 +3358,7 @@ fn tool_install_bad_receipt() -> Result<()> {
|
||||
/// that isn't properly normalized).
|
||||
#[test]
|
||||
fn tool_install_malformed_dist_info() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2025-01-18T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -3435,7 +3435,7 @@ fn tool_install_malformed_dist_info() {
|
||||
/// Test installing, then re-installing with different settings.
|
||||
#[test]
|
||||
fn tool_install_settings() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3589,7 +3589,7 @@ fn tool_install_settings() {
|
||||
/// Test installing a tool with `uv tool install {package}@{version}`.
|
||||
#[test]
|
||||
fn tool_install_at_version() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3655,7 +3655,7 @@ fn tool_install_at_version() {
|
||||
/// Test installing a tool with `uv tool install {package}@latest`.
|
||||
#[test]
|
||||
fn tool_install_at_latest() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3704,7 +3704,7 @@ fn tool_install_at_latest() {
|
||||
/// Test installing a tool with `uv tool install {package} --from {package}@latest`.
|
||||
#[test]
|
||||
fn tool_install_from_at_latest() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2025-01-18T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -3749,7 +3749,7 @@ fn tool_install_from_at_latest() {
|
||||
/// Test installing a tool with `uv tool install {package} --from {package}@{version}`.
|
||||
#[test]
|
||||
fn tool_install_from_at_version() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2025-01-18T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -3794,7 +3794,7 @@ fn tool_install_from_at_version() {
|
||||
/// Test upgrading an already installed tool via `{package}@{latest}`.
|
||||
#[test]
|
||||
fn tool_install_at_latest_upgrade() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -3915,7 +3915,7 @@ fn tool_install_at_latest_upgrade() {
|
||||
/// Install a tool with `--constraints`.
|
||||
#[test]
|
||||
fn tool_install_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -4022,7 +4022,7 @@ fn tool_install_constraints() -> Result<()> {
|
||||
/// Install a tool with `--overrides`.
|
||||
#[test]
|
||||
fn tool_install_overrides() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -4086,7 +4086,7 @@ fn tool_install_overrides() -> Result<()> {
|
||||
/// `uv tool install python` is not allowed
|
||||
#[test]
|
||||
fn tool_install_python() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -4123,7 +4123,7 @@ fn tool_install_python() {
|
||||
|
||||
#[test]
|
||||
fn tool_install_mismatched_name() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -4178,7 +4178,7 @@ fn tool_install_mismatched_name() {
|
||||
/// When installing from an authenticated index, the credentials should be omitted from the receipt.
|
||||
#[test]
|
||||
fn tool_install_credentials() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2025-01-18T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -4258,7 +4258,7 @@ fn tool_install_credentials() {
|
||||
/// When installing from an authenticated index, the credentials should be omitted from the receipt.
|
||||
#[test]
|
||||
fn tool_install_default_credentials() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2025-01-18T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -4380,7 +4380,7 @@ fn tool_install_default_credentials() -> Result<()> {
|
||||
/// Test installing a tool with `--with-executables-from`.
|
||||
#[test]
|
||||
fn tool_install_with_executables_from() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -4470,7 +4470,7 @@ fn tool_install_with_executables_from() {
|
||||
/// Test installing a tool with `--with-executables-from`, but the package has no entrypoints.
|
||||
#[test]
|
||||
fn tool_install_with_executables_from_no_entrypoints() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -4512,7 +4512,7 @@ fn tool_install_with_executables_from_no_entrypoints() {
|
||||
|
||||
#[test]
|
||||
fn tool_install_find_links() {
|
||||
let context = TestContext::new("3.13").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.13").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -4622,7 +4622,7 @@ fn tool_install_find_links() {
|
||||
|
||||
#[test]
|
||||
fn tool_install_python_platform() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use crate::common::{self, TestContext, uv_snapshot};
|
||||
use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::PathChild;
|
||||
use fs_err as fs;
|
||||
use insta::assert_snapshot;
|
||||
use uv_static::EnvVars;
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn tool_list() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -37,7 +37,7 @@ fn tool_list() {
|
||||
|
||||
#[test]
|
||||
fn tool_list_paths() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -67,7 +67,7 @@ fn tool_list_paths() {
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn tool_list_paths_windows() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.clear_filters()
|
||||
.with_filtered_windows_temp_dir();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -98,7 +98,7 @@ fn tool_list_paths_windows() {
|
||||
|
||||
#[test]
|
||||
fn tool_list_empty() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -116,7 +116,7 @@ fn tool_list_empty() {
|
||||
|
||||
#[test]
|
||||
fn tool_list_missing_receipt() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -145,7 +145,7 @@ fn tool_list_missing_receipt() {
|
||||
|
||||
#[test]
|
||||
fn tool_list_bad_environment() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_python_names()
|
||||
.with_filtered_virtualenv_bin()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -170,7 +170,7 @@ fn tool_list_bad_environment() -> Result<()> {
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
let venv_path = common::venv_bin_path(tool_dir.path().join("black"));
|
||||
let venv_path = uv_test::venv_bin_path(tool_dir.path().join("black"));
|
||||
// Remove the python interpreter for black
|
||||
fs::remove_dir_all(venv_path.clone())?;
|
||||
|
||||
@@ -197,7 +197,7 @@ fn tool_list_bad_environment() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_list_deprecated() -> Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -284,7 +284,7 @@ fn tool_list_deprecated() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_list_show_version_specifiers() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -340,7 +340,7 @@ fn tool_list_show_version_specifiers() {
|
||||
|
||||
#[test]
|
||||
fn tool_list_show_with() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -455,7 +455,7 @@ fn tool_list_show_with() {
|
||||
|
||||
#[test]
|
||||
fn tool_list_show_extras() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -566,7 +566,7 @@ fn tool_list_show_extras() {
|
||||
|
||||
#[test]
|
||||
fn tool_list_show_python() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -596,7 +596,7 @@ fn tool_list_show_python() {
|
||||
|
||||
#[test]
|
||||
fn tool_list_show_all() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use crate::common::{TestContext, uv_snapshot, venv_bin_path};
|
||||
use anyhow::Result;
|
||||
use assert_cmd::prelude::*;
|
||||
use assert_fs::prelude::*;
|
||||
use indoc::indoc;
|
||||
use uv_fs::copy_dir_all;
|
||||
use uv_static::EnvVars;
|
||||
use uv_test::{uv_snapshot, venv_bin_path};
|
||||
|
||||
#[test]
|
||||
fn tool_run_args() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let mut filters = context.filters();
|
||||
filters.push((
|
||||
r"Usage: uv tool run \[OPTIONS\] (?s).*",
|
||||
@@ -63,7 +63,7 @@ fn tool_run_args() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_at_version() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -158,7 +158,7 @@ fn tool_run_at_version() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_from_version() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -187,7 +187,7 @@ fn tool_run_from_version() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_constraints() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -219,7 +219,7 @@ fn tool_run_constraints() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_overrides() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -251,7 +251,7 @@ fn tool_run_overrides() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_suggest_valid_commands() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -303,7 +303,7 @@ fn tool_run_suggest_valid_commands() {
|
||||
#[test]
|
||||
fn tool_run_warn_executable_not_in_from() {
|
||||
// FastAPI 0.111 is only available from this date onwards.
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2024-05-04T00:00:00Z")
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -368,7 +368,7 @@ fn tool_run_warn_executable_not_in_from() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_from_install() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -503,7 +503,7 @@ fn tool_run_from_install() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_from_install_constraints() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -686,7 +686,7 @@ fn tool_run_from_install_constraints() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_cache() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"]).with_filtered_counts();
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"]).with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -849,7 +849,7 @@ fn tool_run_cache() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_url() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -935,7 +935,7 @@ fn tool_run_url() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn tool_run_git() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1027,7 +1027,7 @@ fn tool_run_git() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git-lfs")]
|
||||
fn tool_run_git_lfs() {
|
||||
let context = TestContext::new("3.13")
|
||||
let context = uv_test::test_context!("3.13")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix()
|
||||
.with_git_lfs_config();
|
||||
@@ -1197,7 +1197,7 @@ fn tool_run_git_lfs() {
|
||||
/// Read requirements from a `requirements.txt` file.
|
||||
#[test]
|
||||
fn tool_run_requirements_txt() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1239,7 +1239,7 @@ fn tool_run_requirements_txt() {
|
||||
/// Ignore and warn when (e.g.) the `--index-url` argument is a provided `requirements.txt`.
|
||||
#[test]
|
||||
fn tool_run_requirements_txt_arguments() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1285,7 +1285,7 @@ fn tool_run_requirements_txt_arguments() {
|
||||
/// List installed tools when no command arg is given (e.g. `uv tool run`).
|
||||
#[test]
|
||||
fn tool_run_list_installed() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1334,7 +1334,7 @@ fn tool_run_list_installed() {
|
||||
/// By default, omit resolver and installer output.
|
||||
#[test]
|
||||
fn tool_run_without_output() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1375,7 +1375,7 @@ fn tool_run_without_output() {
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn tool_run_csv_with_shorthand() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1437,7 +1437,7 @@ fn tool_run_csv_with_shorthand() -> anyhow::Result<()> {
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn tool_run_csv_with() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1499,7 +1499,7 @@ fn tool_run_csv_with() -> anyhow::Result<()> {
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn tool_run_csv_with() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1561,7 +1561,7 @@ fn tool_run_csv_with() -> anyhow::Result<()> {
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn tool_run_repeated_with() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1625,7 +1625,7 @@ fn tool_run_repeated_with() -> anyhow::Result<()> {
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn tool_run_repeated_with() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1688,7 +1688,7 @@ fn tool_run_repeated_with() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_editable() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1824,7 +1824,7 @@ fn tool_run_with_editable() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn warn_no_executables_found() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1852,7 +1852,7 @@ fn warn_no_executables_found() {
|
||||
/// Warn when a user passes `--upgrade` to `uv tool run`.
|
||||
#[test]
|
||||
fn tool_run_upgrade_warn() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1907,7 +1907,7 @@ fn tool_run_upgrade_warn() {
|
||||
/// If we fail to resolve the tool, we should include "tool" in the error message.
|
||||
#[test]
|
||||
fn tool_run_resolution_error() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1927,7 +1927,7 @@ fn tool_run_resolution_error() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_latest() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -1992,7 +1992,7 @@ fn tool_run_latest() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_latest_extra() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2051,7 +2051,7 @@ fn tool_run_latest_extra() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_extra() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2084,7 +2084,7 @@ fn tool_run_extra() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_specifier() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2116,7 +2116,7 @@ fn tool_run_specifier() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_python() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("python")
|
||||
.arg("--version"), @"
|
||||
@@ -2146,7 +2146,7 @@ fn tool_run_python() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_python_at_version() {
|
||||
let context = TestContext::new_with_versions(&["3.12", "3.11"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.12", "3.11"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_python_sources();
|
||||
|
||||
@@ -2350,7 +2350,7 @@ fn tool_run_python_at_version() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_hint_version_not_available() {
|
||||
let context = TestContext::new_with_versions(&[])
|
||||
let context = uv_test::test_context_with_versions!(&[])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_python_sources();
|
||||
|
||||
@@ -2398,7 +2398,7 @@ fn tool_run_hint_version_not_available() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_python_from_global_version_file() {
|
||||
let context = TestContext::new_with_versions(&["3.12", "3.11"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.12", "3.11"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_python_sources();
|
||||
|
||||
@@ -2425,7 +2425,7 @@ fn tool_run_python_from_global_version_file() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_python_version_overrides_global_pin() {
|
||||
let context = TestContext::new_with_versions(&["3.12", "3.11"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.12", "3.11"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_python_sources();
|
||||
|
||||
@@ -2454,7 +2454,7 @@ fn tool_run_python_version_overrides_global_pin() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_python_with_explicit_default_bypasses_global_pin() {
|
||||
let context = TestContext::new_with_versions(&["3.12", "3.11"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.12", "3.11"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_python_sources();
|
||||
|
||||
@@ -2485,7 +2485,7 @@ fn tool_run_python_with_explicit_default_bypasses_global_pin() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_python_from() {
|
||||
let context = TestContext::new_with_versions(&["3.12", "3.11"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.12", "3.11"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_python_sources();
|
||||
|
||||
@@ -2566,7 +2566,7 @@ fn tool_run_python_from() {
|
||||
|
||||
#[test]
|
||||
fn run_with_env_file() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2660,7 +2660,7 @@ fn run_with_env_file() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_run_from_at() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2025-01-18T00:00:00Z")
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -2707,7 +2707,7 @@ fn tool_run_from_at() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_verbatim_name() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -2795,7 +2795,7 @@ fn tool_run_verbatim_name() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_existing_py_script() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
context.temp_dir.child("script.py").touch()?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_run().arg("script.py"), @"
|
||||
@@ -2813,7 +2813,7 @@ fn tool_run_with_existing_py_script() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_existing_pyw_script() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
context.temp_dir.child("script.pyw").touch()?;
|
||||
|
||||
// We treat arguments before the command as uv arguments
|
||||
@@ -2833,7 +2833,7 @@ fn tool_run_with_existing_pyw_script() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_nonexistent_py_script() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
|
||||
// We treat arguments before the command as uv arguments
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
@@ -2851,7 +2851,7 @@ fn tool_run_with_nonexistent_py_script() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_nonexistent_pyw_script() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
|
||||
// We treat arguments before the command as uv arguments
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
@@ -2869,7 +2869,7 @@ fn tool_run_with_nonexistent_pyw_script() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_from_script() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
|
||||
// We treat arguments before the command as uv arguments
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
@@ -2889,7 +2889,7 @@ fn tool_run_with_from_script() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_script_and_from_script() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
|
||||
// We treat arguments before the command as uv arguments
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
@@ -2911,7 +2911,7 @@ fn tool_run_with_script_and_from_script() {
|
||||
/// we show a helpful hint.
|
||||
#[test]
|
||||
fn tool_run_verbose_hint() {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -2981,7 +2981,7 @@ fn tool_run_verbose_hint() {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_compatible_build_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.9")
|
||||
let context = uv_test::test_context!("3.9")
|
||||
.with_exclude_newer("2024-05-04T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -3018,7 +3018,7 @@ fn tool_run_with_compatible_build_constraints() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_incompatible_build_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.9")
|
||||
let context = uv_test::test_context!("3.9")
|
||||
.with_exclude_newer("2024-05-04T00:00:00Z")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
@@ -3054,7 +3054,7 @@ fn tool_run_with_incompatible_build_constraints() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_run_with_dependencies_from_script() -> Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_missing_file_error();
|
||||
|
||||
@@ -3155,7 +3155,7 @@ fn tool_run_with_dependencies_from_script() -> Result<()> {
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn tool_run_windows_runnable_types() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -3467,7 +3467,7 @@ fn tool_run_windows_runnable_types() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_run_reresolve_python() -> anyhow::Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"]).with_filtered_counts();
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"]).with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
let foo_dir = context.temp_dir.child("foo");
|
||||
@@ -3561,7 +3561,7 @@ fn tool_run_reresolve_python() -> anyhow::Result<()> {
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn tool_run_windows_dotted_package_name() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12").with_filtered_counts();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -3597,7 +3597,7 @@ fn tool_run_windows_dotted_package_name() -> anyhow::Result<()> {
|
||||
/// Regression test for <https://github.com/astral-sh/uv/issues/17436>
|
||||
#[test]
|
||||
fn tool_run_latest_keyring_auth() {
|
||||
let keyring_context = TestContext::new("3.12");
|
||||
let keyring_context = uv_test::test_context!("3.12");
|
||||
|
||||
// Install our keyring plugin
|
||||
keyring_context
|
||||
@@ -3612,7 +3612,7 @@ fn tool_run_latest_keyring_auth() {
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_exclude_newer("2025-01-18T00:00:00Z")
|
||||
.with_filtered_counts();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
|
||||
@@ -3,11 +3,11 @@ use assert_fs::fixture::PathChild;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn tool_uninstall() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -68,7 +68,7 @@ fn tool_uninstall() {
|
||||
|
||||
#[test]
|
||||
fn tool_uninstall_multiple_names() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -115,7 +115,7 @@ fn tool_uninstall_multiple_names() {
|
||||
|
||||
#[test]
|
||||
fn tool_uninstall_not_installed() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -133,7 +133,7 @@ fn tool_uninstall_not_installed() {
|
||||
|
||||
#[test]
|
||||
fn tool_uninstall_missing_receipt() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
@@ -162,7 +162,7 @@ fn tool_uninstall_missing_receipt() {
|
||||
|
||||
#[test]
|
||||
fn tool_uninstall_all_missing_receipt() {
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let context = uv_test::test_context!("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ use insta::assert_snapshot;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_empty() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -92,7 +92,7 @@ fn tool_upgrade_empty() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_name() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -142,7 +142,7 @@ fn tool_upgrade_name() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_multiple_names() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -217,7 +217,7 @@ fn tool_upgrade_multiple_names() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_pinned_hint() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
|
||||
@@ -268,7 +268,7 @@ fn tool_upgrade_pinned_hint() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_pinned_hint_with_mixed_constraint() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
|
||||
@@ -320,7 +320,7 @@ fn tool_upgrade_pinned_hint_with_mixed_constraint() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_all() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -394,7 +394,7 @@ fn tool_upgrade_all() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_non_existing_package() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -432,7 +432,7 @@ fn tool_upgrade_non_existing_package() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_not_stop_if_upgrade_fails() -> anyhow::Result<()> {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -512,7 +512,7 @@ fn tool_upgrade_not_stop_if_upgrade_fails() -> anyhow::Result<()> {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_settings() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -577,7 +577,7 @@ fn tool_upgrade_settings() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_respect_constraints() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -628,7 +628,7 @@ fn tool_upgrade_respect_constraints() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_constraint() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -743,7 +743,7 @@ fn tool_upgrade_constraint() {
|
||||
/// itself.
|
||||
#[test]
|
||||
fn tool_upgrade_with() {
|
||||
let context = TestContext::new("3.12")
|
||||
let context = uv_test::test_context!("3.12")
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -793,7 +793,7 @@ fn tool_upgrade_with() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_python() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -852,7 +852,7 @@ fn tool_upgrade_python() {
|
||||
|
||||
#[test]
|
||||
fn tool_upgrade_python_with_all() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
@@ -945,7 +945,7 @@ fn tool_upgrade_python_with_all() {
|
||||
/// packages.
|
||||
#[test]
|
||||
fn test_tool_upgrade_additional_entrypoints() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"])
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"])
|
||||
.with_filtered_counts()
|
||||
.with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
|
||||
+24
-24
@@ -5,11 +5,11 @@ use indoc::{formatdoc, indoc};
|
||||
use insta::assert_snapshot;
|
||||
use url::Url;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn nested_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -50,7 +50,7 @@ fn nested_dependencies() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn nested_platform_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -117,7 +117,7 @@ fn nested_platform_dependencies() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn invert() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -179,7 +179,7 @@ fn invert() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn frozen() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -241,7 +241,7 @@ fn frozen() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn outdated() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -273,7 +273,7 @@ fn outdated() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn platform_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -353,7 +353,7 @@ fn platform_dependencies() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn platform_dependencies_inverted() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -398,7 +398,7 @@ fn platform_dependencies_inverted() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn repeated_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -444,7 +444,7 @@ fn repeated_dependencies() -> Result<()> {
|
||||
/// URLs.
|
||||
#[test]
|
||||
fn repeated_version() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let v1 = context.temp_dir.child("v1");
|
||||
fs_err::create_dir_all(&v1)?;
|
||||
@@ -516,7 +516,7 @@ fn repeated_version() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn dev_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -570,7 +570,7 @@ fn dev_dependencies() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn dev_dependencies_inverted() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -627,7 +627,7 @@ fn dev_dependencies_inverted() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn optional_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -677,7 +677,7 @@ fn optional_dependencies() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn optional_dependencies_inverted() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -735,7 +735,7 @@ fn optional_dependencies_inverted() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn package() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -810,7 +810,7 @@ fn package() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn group() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -920,7 +920,7 @@ fn group() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn cycle() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1006,7 +1006,7 @@ fn cycle() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn workspace_dev() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1085,7 +1085,7 @@ fn workspace_dev() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn non_project() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1121,7 +1121,7 @@ fn non_project() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn non_project_member() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1195,7 +1195,7 @@ fn non_project_member() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn script() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let script = context.temp_dir.child("script.py");
|
||||
script.write_str(indoc! {r#"
|
||||
@@ -1594,7 +1594,7 @@ fn script() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn only_group() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1676,7 +1676,7 @@ fn only_group() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn show_sizes() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1706,7 +1706,7 @@ fn show_sizes() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn workspace_circular_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create workspace root
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
|
||||
+46
-46
@@ -9,11 +9,11 @@ use uv_static::EnvVars;
|
||||
#[cfg(unix)]
|
||||
use fs_err::os::unix::fs::symlink;
|
||||
|
||||
use crate::common::{TestContext, uv_snapshot};
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
#[test]
|
||||
fn create_venv() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a virtual environment at `.venv`.
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
@@ -72,7 +72,7 @@ fn create_venv() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_313() {
|
||||
let context = TestContext::new_with_versions(&["3.13"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.13"]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
@@ -94,7 +94,7 @@ fn create_venv_313() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_project_environment() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// `uv venv` ignores `UV_PROJECT_ENVIRONMENT` when it's not a project
|
||||
uv_snapshot!(context.filters(), context.venv().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @"
|
||||
@@ -213,7 +213,7 @@ fn create_venv_project_environment() -> Result<()> {
|
||||
#[test]
|
||||
fn virtual_empty() -> Result<()> {
|
||||
// testing how `uv venv` reacts to a pyproject with no `[project]` and nothing useful to it
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -239,7 +239,7 @@ fn virtual_empty() -> Result<()> {
|
||||
fn virtual_dependency_group() -> Result<()> {
|
||||
// testing basic `uv venv` functionality
|
||||
// when the pyproject.toml is fully virtual (no `[project]`, but `[dependency-groups]` defined)
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -265,7 +265,7 @@ fn virtual_dependency_group() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn create_venv_defaults_to_cwd() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg("--python")
|
||||
.arg("3.12"), @"
|
||||
@@ -285,7 +285,7 @@ fn create_venv_defaults_to_cwd() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_ignores_virtual_env_variable() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
// We shouldn't care if `VIRTUAL_ENV` is set to an non-existent directory
|
||||
// because we ignore virtual environment interpreter sources (we require a system interpreter)
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
@@ -304,7 +304,7 @@ fn create_venv_ignores_virtual_env_variable() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_reads_request_from_python_version_file() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
|
||||
// Without the file, we should use the first on the PATH
|
||||
uv_snapshot!(context.filters(), context.venv(), @"
|
||||
@@ -343,7 +343,7 @@ fn create_venv_reads_request_from_python_version_file() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_reads_request_from_python_versions_file() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
|
||||
// Without the file, we should use the first on the PATH
|
||||
uv_snapshot!(context.filters(), context.venv(), @"
|
||||
@@ -382,7 +382,7 @@ fn create_venv_reads_request_from_python_versions_file() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_respects_pyproject_requires_python() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.9", "3.10", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.9", "3.10", "3.12"]);
|
||||
|
||||
// Without a Python requirement, we use the first on the PATH
|
||||
uv_snapshot!(context.filters(), context.venv(), @"
|
||||
@@ -567,7 +567,7 @@ fn create_venv_respects_pyproject_requires_python() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn create_venv_respects_group_requires_python() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.9", "3.10", "3.11", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.9", "3.10", "3.11", "3.12"]);
|
||||
|
||||
// Without a Python requirement, we use the first on the PATH
|
||||
uv_snapshot!(context.filters(), context.venv(), @"
|
||||
@@ -745,7 +745,7 @@ fn create_venv_respects_group_requires_python() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn create_venv_ignores_missing_pyproject_metadata() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r"[tool.no.project.here]" })?;
|
||||
@@ -769,7 +769,7 @@ fn create_venv_ignores_missing_pyproject_metadata() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn create_venv_warns_user_on_requires_python_discovery_error() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! { r"invalid toml" })?;
|
||||
@@ -807,7 +807,7 @@ fn create_venv_warns_user_on_requires_python_discovery_error() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn create_venv_explicit_request_takes_priority_over_python_version_file() {
|
||||
let context = TestContext::new_with_versions(&["3.11", "3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.11", "3.12"]);
|
||||
|
||||
context
|
||||
.temp_dir
|
||||
@@ -833,7 +833,7 @@ fn create_venv_explicit_request_takes_priority_over_python_version_file() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn seed() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
.arg("--seed")
|
||||
@@ -857,7 +857,7 @@ fn seed() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn seed_older_python_version() {
|
||||
let context = TestContext::new_with_versions(&["3.11"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.11"]);
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
.arg("--seed")
|
||||
@@ -882,7 +882,7 @@ fn seed_older_python_version() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_with_invalid_http_timeout() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]).with_http_timeout("not_a_number");
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]).with_http_timeout("not_a_number");
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
.arg("--python")
|
||||
@@ -898,7 +898,7 @@ fn create_venv_with_invalid_http_timeout() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_with_invalid_concurrent_installs() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]).with_concurrent_installs("0");
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]).with_concurrent_installs("0");
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
.arg("--python")
|
||||
@@ -914,7 +914,7 @@ fn create_venv_with_invalid_concurrent_installs() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_unknown_python_minor() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]).with_filtered_python_sources();
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]).with_filtered_python_sources();
|
||||
|
||||
let mut command = context.venv();
|
||||
command
|
||||
@@ -940,7 +940,7 @@ fn create_venv_unknown_python_minor() {
|
||||
|
||||
#[test]
|
||||
fn create_venv_unknown_python_patch() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]).with_filtered_python_sources();
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]).with_filtered_python_sources();
|
||||
|
||||
let mut command = context.venv();
|
||||
command
|
||||
@@ -967,7 +967,7 @@ fn create_venv_unknown_python_patch() {
|
||||
#[cfg(feature = "test-python-patch")]
|
||||
#[test]
|
||||
fn create_venv_python_patch() {
|
||||
let context = TestContext::new_with_versions(&["3.12.9"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12.9"]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
@@ -989,7 +989,7 @@ fn create_venv_python_patch() {
|
||||
|
||||
#[test]
|
||||
fn file_exists() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a file at `.venv`. Creating a virtualenv at the same path should fail.
|
||||
context.venv.touch()?;
|
||||
@@ -1015,7 +1015,7 @@ fn file_exists() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn empty_dir_exists() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create an empty directory at `.venv`. Creating a virtualenv at the same path should succeed.
|
||||
context.venv.create_dir_all()?;
|
||||
@@ -1041,7 +1041,7 @@ fn empty_dir_exists() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn non_empty_dir_exists() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a non-empty directory at `.venv`. Creating a virtualenv at the same path should fail,
|
||||
// unless `--clear` is specified.
|
||||
@@ -1086,7 +1086,7 @@ fn non_empty_dir_exists() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn non_empty_dir_exists_allow_existing() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a non-empty directory at `.venv`. Creating a virtualenv at the same path should
|
||||
// succeed when `--allow-existing` is specified, but fail when it is not.
|
||||
@@ -1151,7 +1151,7 @@ fn non_empty_dir_exists_allow_existing() -> Result<()> {
|
||||
/// Run `uv venv` followed by `uv venv --allow-existing`.
|
||||
#[test]
|
||||
fn create_venv_then_allow_existing() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a venv
|
||||
uv_snapshot!(context.filters(), context.venv(), @"
|
||||
@@ -1184,7 +1184,7 @@ fn create_venv_then_allow_existing() {
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn windows_shims() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.10", "3.9"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.10", "3.9"]);
|
||||
let shim_path = context.temp_dir.child("shim");
|
||||
|
||||
let py39 = context
|
||||
@@ -1230,7 +1230,7 @@ fn windows_shims() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn verify_pyvenv_cfg() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyvenv_cfg = context.venv.child("pyvenv.cfg");
|
||||
|
||||
context.venv.assert(predicates::path::is_dir());
|
||||
@@ -1249,7 +1249,7 @@ fn verify_pyvenv_cfg() {
|
||||
|
||||
#[test]
|
||||
fn verify_pyvenv_cfg_relocatable() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a virtual environment at `.venv`.
|
||||
context
|
||||
@@ -1310,7 +1310,7 @@ fn verify_pyvenv_cfg_relocatable() {
|
||||
/// With `relocatable-envs-default` preview feature, venvs are relocatable by default.
|
||||
#[test]
|
||||
fn relocatable_envs_default_preview() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a virtual environment with the preview feature enabled.
|
||||
context
|
||||
@@ -1334,7 +1334,7 @@ fn relocatable_envs_default_preview() {
|
||||
/// With `relocatable-envs-default` preview feature, `--no-relocatable` opts out.
|
||||
#[test]
|
||||
fn relocatable_envs_default_no_relocatable() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create a virtual environment with the preview feature but opt out.
|
||||
context
|
||||
@@ -1359,7 +1359,7 @@ fn relocatable_envs_default_no_relocatable() {
|
||||
/// Ensure that a nested virtual environment uses the same `home` directory as the parent.
|
||||
#[test]
|
||||
fn verify_nested_pyvenv_cfg() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a virtual environment at `.venv`.
|
||||
context
|
||||
@@ -1412,7 +1412,7 @@ fn verify_nested_pyvenv_cfg() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn path_with_trailing_space_gives_proper_error() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Set a custom cache directory with a trailing space
|
||||
let path_with_trailing_slash = format!("{} ", context.cache_dir.path().display());
|
||||
@@ -1423,7 +1423,7 @@ fn path_with_trailing_space_gives_proper_error() {
|
||||
r"CACHEDIR.TAG`: .* \(os error 3\)",
|
||||
"CACHEDIR.TAG`: The system cannot find the path specified. (os error 3)",
|
||||
));
|
||||
uv_snapshot!(filters, std::process::Command::new(crate::common::get_bin())
|
||||
uv_snapshot!(filters, std::process::Command::new(uv_test::get_bin!())
|
||||
.arg("venv")
|
||||
.env(EnvVars::UV_CACHE_DIR, path_with_trailing_slash), @r###"
|
||||
success: false
|
||||
@@ -1448,7 +1448,7 @@ fn create_venv_apostrophe() {
|
||||
use std::process::Command;
|
||||
use std::process::Stdio;
|
||||
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
let venv_dir = context.temp_dir.join("Testing's");
|
||||
|
||||
@@ -1495,7 +1495,7 @@ fn create_venv_apostrophe() {
|
||||
#[test]
|
||||
fn venv_python_preference() {
|
||||
let context =
|
||||
TestContext::new_with_versions(&["3.12", "3.11"]).with_versions_as_managed(&["3.12"]);
|
||||
uv_test::test_context_with_versions!(&["3.12", "3.11"]).with_versions_as_managed(&["3.12"]);
|
||||
|
||||
// Create a managed interpreter environment
|
||||
uv_snapshot!(context.filters(), context.venv(), @"
|
||||
@@ -1559,7 +1559,7 @@ fn venv_python_preference() {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn create_venv_symlink_clear_preservation() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a target directory
|
||||
let target_dir = context.temp_dir.child("target");
|
||||
@@ -1617,7 +1617,7 @@ fn create_venv_symlink_clear_preservation() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn create_venv_symlink_recreate_preservation() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a target directory
|
||||
let target_dir = context.temp_dir.child("target");
|
||||
@@ -1675,7 +1675,7 @@ fn create_venv_symlink_recreate_preservation() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn create_venv_nested_symlink_preservation() -> Result<()> {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a target directory
|
||||
let target_dir = context.temp_dir.child("target");
|
||||
@@ -1741,7 +1741,7 @@ fn create_venv_nested_symlink_preservation() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn create_venv_current_working_directory() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
@@ -1783,7 +1783,7 @@ fn create_venv_current_working_directory() {
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn create_venv_current_working_directory() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
@@ -1821,7 +1821,7 @@ fn create_venv_current_working_directory() {
|
||||
|
||||
#[test]
|
||||
fn no_clear_with_existing_directory() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a virtual environment first
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
@@ -1862,7 +1862,7 @@ fn no_clear_with_existing_directory() {
|
||||
|
||||
#[test]
|
||||
fn no_clear_with_non_existent_directory() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create with --no-clear on non-existent directory (should succeed)
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
@@ -1886,7 +1886,7 @@ fn no_clear_with_non_existent_directory() {
|
||||
|
||||
#[test]
|
||||
fn no_clear_overrides_clear() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Create a non-empty directory at `.venv`
|
||||
context.venv.create_dir_all().unwrap();
|
||||
@@ -1916,7 +1916,7 @@ fn no_clear_overrides_clear() {
|
||||
|
||||
#[test]
|
||||
fn no_clear_conflicts_with_allow_existing() {
|
||||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
let context = uv_test::test_context_with_versions!(&["3.12"]);
|
||||
|
||||
// Try to use --no-clear with --allow-existing (should fail)
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
|
||||
@@ -4,13 +4,13 @@ use assert_fs::prelude::*;
|
||||
use indoc::indoc;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
use crate::common::TestContext;
|
||||
use crate::common::uv_snapshot;
|
||||
use uv_test::TestContext;
|
||||
use uv_test::uv_snapshot;
|
||||
|
||||
// Print the version
|
||||
#[test]
|
||||
fn version_get() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -48,7 +48,7 @@ fn version_get() -> Result<()> {
|
||||
// Print the version (json format)
|
||||
#[test]
|
||||
fn version_get_json() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -91,7 +91,7 @@ fn version_get_json() -> Result<()> {
|
||||
// Print the version (--short)
|
||||
#[test]
|
||||
fn version_get_short() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -131,7 +131,7 @@ fn version_get_short() -> Result<()> {
|
||||
// Set the version
|
||||
#[test]
|
||||
fn version_set_value() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -173,7 +173,7 @@ requires-python = ">=3.12"
|
||||
// Set the version (--short)
|
||||
#[test]
|
||||
fn version_set_value_short() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -216,7 +216,7 @@ requires-python = ">=3.12"
|
||||
// Bump patch version
|
||||
#[test]
|
||||
fn version_bump_patch() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -256,7 +256,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn version_bump_patch_value() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -296,7 +296,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn version_bump_minor_value() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -336,7 +336,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn version_bump_major_value() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -377,7 +377,7 @@ requires-python = ">=3.12"
|
||||
// Bump patch version (--short)
|
||||
#[test]
|
||||
fn version_bump_patch_short() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -418,7 +418,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn version_bump_patch_value_must_increase() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -457,7 +457,7 @@ requires-python = ">=3.12"
|
||||
/// Preserve comments immediately preceding the version when bumping
|
||||
#[test]
|
||||
fn version_bump_preserves_preceding_comments() -> Result<()> {
|
||||
let context: TestContext = TestContext::new("3.12");
|
||||
let context: TestContext = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -502,7 +502,7 @@ fn version_bump_preserves_preceding_comments() -> Result<()> {
|
||||
// Bump minor version
|
||||
#[test]
|
||||
fn version_bump_minor() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -543,7 +543,7 @@ requires-python = ">=3.12"
|
||||
// bump major version
|
||||
#[test]
|
||||
fn version_major_version() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -584,7 +584,7 @@ requires-python = ">=3.12"
|
||||
// Bump patch but the input version is missing a component
|
||||
#[test]
|
||||
fn version_patch_uncompleted() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -625,7 +625,7 @@ requires-python = ">=3.12"
|
||||
// Bump minor but the input version is missing a component
|
||||
#[test]
|
||||
fn version_minor_uncompleted() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -666,7 +666,7 @@ requires-python = ">=3.12"
|
||||
// Bump major but the input version is missing a component
|
||||
#[test]
|
||||
fn version_major_uncompleted() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -707,7 +707,7 @@ requires-python = ">=3.12"
|
||||
// Bump major but the input version is .dev
|
||||
#[test]
|
||||
fn version_major_dev() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -748,7 +748,7 @@ requires-python = ">=3.12"
|
||||
// Bump major but the input version is a complex mess
|
||||
#[test]
|
||||
fn version_major_complex_mess() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -792,7 +792,7 @@ requires-python = ">=3.12"
|
||||
// now it fails for a dozen reasons!
|
||||
#[test]
|
||||
fn many_bump_complex() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -838,7 +838,7 @@ requires-python = ">=3.12"
|
||||
// --bump stable
|
||||
#[test]
|
||||
fn bump_stable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -879,7 +879,7 @@ requires-python = ">=3.12"
|
||||
// --bump alpha
|
||||
#[test]
|
||||
fn bump_alpha() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -920,7 +920,7 @@ requires-python = ">=3.12"
|
||||
// --bump beta
|
||||
#[test]
|
||||
fn bump_beta() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -960,7 +960,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_beta_with_value_existing() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1000,7 +1000,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_beta_with_value_new() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1042,7 +1042,7 @@ requires-python = ">=3.12"
|
||||
// --bump rc
|
||||
#[test]
|
||||
fn bump_rc() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1083,7 +1083,7 @@ requires-python = ">=3.12"
|
||||
// --bump post
|
||||
#[test]
|
||||
fn bump_post() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1123,7 +1123,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_post_with_value_clears_dev() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1164,7 +1164,7 @@ requires-python = ">=3.12"
|
||||
// --bump dev
|
||||
#[test]
|
||||
fn bump_dev() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1204,7 +1204,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_dev_with_value() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1244,7 +1244,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_patch_and_dev_value() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1285,7 +1285,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_patch_and_dev_explicit_values_sorted() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1327,7 +1327,7 @@ requires-python = ">=3.12"
|
||||
// Bump major but the input version is .post
|
||||
#[test]
|
||||
fn version_major_post() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1367,7 +1367,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_stable_with_value_fails() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1393,7 +1393,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_empty_value_fails() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1419,7 +1419,7 @@ requires-python = ">=3.12"
|
||||
|
||||
#[test]
|
||||
fn bump_invalid_numeric_value_fails() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1446,7 +1446,7 @@ requires-python = ">=3.12"
|
||||
// --bump stable but it decreases the version
|
||||
#[test]
|
||||
fn bump_decrease_stable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1473,7 +1473,7 @@ requires-python = ">=3.12"
|
||||
// --bump alpha but it decreases the version by reverting beta
|
||||
#[test]
|
||||
fn bump_decrease_alpha_beta() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1500,7 +1500,7 @@ requires-python = ">=3.12"
|
||||
// --bump alpha but it decreases the version from a stable
|
||||
#[test]
|
||||
fn bump_decrease_alpha_stable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1527,7 +1527,7 @@ requires-python = ">=3.12"
|
||||
// --bump dev but it decreases the version from a stable
|
||||
#[test]
|
||||
fn bump_decrease_dev_stable() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1554,7 +1554,7 @@ requires-python = ">=3.12"
|
||||
// --bump dev but it decreases the version from a pre-release
|
||||
#[test]
|
||||
fn bump_decrease_dev_prerelease() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1581,7 +1581,7 @@ requires-python = ">=3.12"
|
||||
// --bump major twice
|
||||
#[test]
|
||||
fn bump_double_major() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1609,7 +1609,7 @@ requires-python = ">=3.12"
|
||||
// --bump alpha twice
|
||||
#[test]
|
||||
fn bump_double_alpha() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1637,7 +1637,7 @@ requires-python = ">=3.12"
|
||||
// --bump stable --bump major
|
||||
#[test]
|
||||
fn bump_stable_major() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1665,7 +1665,7 @@ requires-python = ">=3.12"
|
||||
// --bump major --bump alpha
|
||||
#[test]
|
||||
fn bump_alpha_major() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1695,7 +1695,7 @@ requires-python = ">=3.12"
|
||||
// --bump major --bump minor
|
||||
#[test]
|
||||
fn bump_minor_major() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1725,7 +1725,7 @@ requires-python = ">=3.12"
|
||||
// --bump alpha --bump dev
|
||||
#[test]
|
||||
fn bump_alpha_dev() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1753,7 +1753,7 @@ requires-python = ">=3.12"
|
||||
// --bump major --bump dev
|
||||
#[test]
|
||||
fn bump_dev_major() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1783,7 +1783,7 @@ requires-python = ">=3.12"
|
||||
// --bump major --bump post
|
||||
#[test]
|
||||
fn bump_post_major() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1811,7 +1811,7 @@ requires-python = ">=3.12"
|
||||
// Set version --dry-run
|
||||
#[test]
|
||||
fn version_set_dry() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1851,7 +1851,7 @@ requires-python = ">=3.12"
|
||||
// Bump version --dry-run
|
||||
#[test]
|
||||
fn version_major_dry() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1891,7 +1891,7 @@ requires-python = ">=3.12"
|
||||
// Set version invalid
|
||||
#[test]
|
||||
fn version_set_invalid() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1930,7 +1930,7 @@ requires-python = ">=3.12"
|
||||
// forget --bump but pass a valid bump name
|
||||
#[test]
|
||||
fn version_missing_bump() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -1969,7 +1969,7 @@ requires-python = ">=3.12"
|
||||
// Dynamic version should error on read
|
||||
#[test]
|
||||
fn version_get_dynamic() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2007,7 +2007,7 @@ fn version_get_dynamic() -> Result<()> {
|
||||
// Dynamic version should error on write
|
||||
#[test]
|
||||
fn version_set_dynamic() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2047,7 +2047,7 @@ fn version_set_dynamic() -> Result<()> {
|
||||
/// (In this case, because tool.uv.managed = false)
|
||||
#[test]
|
||||
fn version_get_fallback_unmanaged() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2089,7 +2089,7 @@ fn version_get_fallback_unmanaged() -> Result<()> {
|
||||
// version_get_fallback with `--short`
|
||||
#[test]
|
||||
fn version_get_fallback_unmanaged_short() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2157,7 +2157,7 @@ fn git_version_info_expected() -> bool {
|
||||
// and --project was passed explicitly.
|
||||
#[test]
|
||||
fn version_get_fallback_unmanaged_strict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2201,7 +2201,7 @@ fn version_get_fallback_unmanaged_strict() -> Result<()> {
|
||||
// and --project was passed explicitly.
|
||||
#[test]
|
||||
fn version_get_fallback_missing_strict() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.version()
|
||||
.arg("--project").arg("."), @"
|
||||
@@ -2219,7 +2219,7 @@ fn version_get_fallback_missing_strict() -> Result<()> {
|
||||
/// Should error with hint if pyproject.toml is missing in normal mode
|
||||
#[test]
|
||||
fn version_get_missing_with_hint() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.version(), @"
|
||||
success: false
|
||||
@@ -2239,7 +2239,7 @@ fn version_get_missing_with_hint() -> Result<()> {
|
||||
// (also setup a honeypot project and make sure it's not used)
|
||||
#[test]
|
||||
fn self_version() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2276,7 +2276,7 @@ fn self_version() -> Result<()> {
|
||||
// (also setup a honeypot project and make sure it's not used)
|
||||
#[test]
|
||||
fn self_version_short() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2322,7 +2322,7 @@ fn self_version_short() -> Result<()> {
|
||||
// (also setup a honeypot project and make sure it's not used)
|
||||
#[test]
|
||||
fn self_version_json() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2407,7 +2407,7 @@ fn self_version_json() -> Result<()> {
|
||||
// Ensure that the global `--project` option is respected.
|
||||
#[test]
|
||||
fn version_get_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2491,7 +2491,7 @@ fn version_get_workspace() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn version_set_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let workspace = context.temp_dir.child("pyproject.toml");
|
||||
workspace.write_str(indoc! {r#"
|
||||
@@ -2833,7 +2833,7 @@ fn version_set_workspace() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn version_set_evil_constraints() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let workspace = context.temp_dir.child("pyproject.toml");
|
||||
workspace.write_str(indoc! {r#"
|
||||
@@ -3077,7 +3077,7 @@ fn version_set_evil_constraints() -> Result<()> {
|
||||
#[test]
|
||||
fn virtual_empty() -> Result<()> {
|
||||
// testing how `uv version` reacts to a pyproject with no `[project]` and nothing useful to it
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -3141,7 +3141,7 @@ fn add_virtual_dependency_group() -> Result<()> {
|
||||
// testing basic `uv version` functionality
|
||||
// when the pyproject.toml is fully virtual (no `[project]`)
|
||||
// But at least has some dependency-group tables (shouldn't matter to this command)
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
@@ -3210,7 +3210,7 @@ fn add_virtual_dependency_group() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn version_extras() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use crate::common::{TestContext, diff_snapshot, uv_snapshot};
|
||||
use anyhow::Result;
|
||||
use assert_fs::fixture::{FileWriteStr, PathChild};
|
||||
use insta::assert_snapshot;
|
||||
use uv_test::{diff_snapshot, uv_snapshot};
|
||||
|
||||
#[test]
|
||||
fn packse_add_remove_one_package() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context.copy_ecosystem_project("packse");
|
||||
|
||||
uv_snapshot!(context.filters(), context.lock(), @"
|
||||
@@ -213,7 +213,7 @@ fn packse_add_remove_one_package() {
|
||||
|
||||
#[test]
|
||||
fn packse_add_remove_existing_package_noop() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context.copy_ecosystem_project("packse");
|
||||
|
||||
uv_snapshot!(context.filters(), context.lock(), @"
|
||||
@@ -249,7 +249,7 @@ fn packse_add_remove_existing_package_noop() {
|
||||
/// transitive dependency.
|
||||
#[test]
|
||||
fn packse_promote_transitive_to_direct_then_remove() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context.copy_ecosystem_project("packse");
|
||||
|
||||
uv_snapshot!(context.filters(), context.lock(), @"
|
||||
@@ -397,7 +397,7 @@ fn packse_promote_transitive_to_direct_then_remove() {
|
||||
|
||||
#[test]
|
||||
fn jax_instability() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
r#"
|
||||
|
||||
@@ -10,7 +10,7 @@ use indoc::indoc;
|
||||
use insta::{assert_json_snapshot, assert_snapshot};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::common::{TestContext, copy_dir_ignore, make_project, uv_snapshot};
|
||||
use uv_test::{copy_dir_ignore, make_project, uv_snapshot};
|
||||
|
||||
fn workspaces_dir() -> PathBuf {
|
||||
env::current_dir()
|
||||
@@ -26,7 +26,7 @@ fn workspaces_dir() -> PathBuf {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_albatross_in_examples_bird_feeder() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
|
||||
@@ -70,7 +70,7 @@ fn test_albatross_in_examples_bird_feeder() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_albatross_in_examples() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
|
||||
@@ -111,7 +111,7 @@ fn test_albatross_in_examples() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_albatross_just_project() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
|
||||
@@ -152,7 +152,7 @@ fn test_albatross_just_project() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_albatross_project_in_excluded() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
|
||||
@@ -228,7 +228,7 @@ fn test_albatross_project_in_excluded() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_albatross_root_workspace() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
|
||||
@@ -272,7 +272,7 @@ fn test_albatross_root_workspace() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_albatross_root_workspace_bird_feeder() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
|
||||
@@ -318,7 +318,7 @@ fn test_albatross_root_workspace_bird_feeder() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_albatross_root_workspace_albatross() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
|
||||
@@ -364,7 +364,7 @@ fn test_albatross_root_workspace_albatross() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_albatross_virtual_workspace() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
|
||||
@@ -412,7 +412,7 @@ fn test_albatross_virtual_workspace() {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_uv_run_with_package_virtual_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let work_dir = context.temp_dir.join("albatross-virtual-workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -482,7 +482,7 @@ fn test_uv_run_with_package_virtual_workspace() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_uv_run_virtual_workspace_root() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let work_dir = context.temp_dir.join("albatross-virtual-workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -523,7 +523,7 @@ fn test_uv_run_virtual_workspace_root() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_uv_run_with_package_root_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let work_dir = context.temp_dir.join("albatross-root-workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir().join("albatross-root-workspace"), &work_dir)?;
|
||||
@@ -586,7 +586,7 @@ fn test_uv_run_with_package_root_workspace() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn test_uv_run_isolate() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let work_dir = context.temp_dir.join("albatross-root-workspace");
|
||||
|
||||
copy_dir_ignore(workspaces_dir().join("albatross-root-workspace"), &work_dir)?;
|
||||
@@ -682,7 +682,7 @@ fn workspace_lock_idempotence(workspace: &str, subdirectories: &[&str]) -> Resul
|
||||
let mut shared_lock = None;
|
||||
|
||||
for dir in subdirectories {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let work_dir = context.temp_dir.join(workspace);
|
||||
|
||||
copy_dir_ignore(workspaces_dir().join(workspace), &work_dir)?;
|
||||
@@ -759,7 +759,7 @@ struct Package {
|
||||
/// `e`. We have `a -> b`, `b -> c`, `c -> d`. `e` should not be installed.
|
||||
#[test]
|
||||
fn workspace_to_workspace_paths_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build the main workspace ...
|
||||
let main_workspace = context.temp_dir.child("main-workspace");
|
||||
@@ -855,7 +855,7 @@ fn workspace_to_workspace_paths_dependencies() -> Result<()> {
|
||||
/// Ensure that workspace discovery skips an empty directory that matches a member glob.
|
||||
#[test]
|
||||
fn workspace_empty_member() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build the main workspace ...
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1083,7 +1083,7 @@ fn workspace_nonempty_member_no_pyproject() -> Result<()> {
|
||||
/// Ensure that workspace discovery ignores hidden directories.
|
||||
#[test]
|
||||
fn workspace_hidden_files() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build the main workspace ...
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1139,7 +1139,7 @@ fn workspace_hidden_files() -> Result<()> {
|
||||
/// Ensure that workspace discovery accepts valid hidden directories.
|
||||
#[test]
|
||||
fn workspace_hidden_member() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build the main workspace ...
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1205,7 +1205,7 @@ fn workspace_hidden_member() -> Result<()> {
|
||||
/// Ensure that workspace discovery accepts valid hidden directories.
|
||||
#[test]
|
||||
fn workspace_non_included_member() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build the main workspace ...
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1268,7 +1268,7 @@ fn workspace_non_included_member() -> Result<()> {
|
||||
/// relative to the member.
|
||||
#[test]
|
||||
fn workspace_inherit_sources() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create the workspace root.
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1502,7 +1502,7 @@ fn workspace_inherit_sources() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn workspace_unsatisfiable_member_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create the workspace root.
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1558,7 +1558,7 @@ fn workspace_unsatisfiable_member_dependencies() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn workspace_unsatisfiable_member_dependencies_conflicting() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create the workspace root.
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1626,7 +1626,7 @@ fn workspace_unsatisfiable_member_dependencies_conflicting() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn workspace_unsatisfiable_member_dependencies_conflicting_threeway() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create the workspace root.
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1709,7 +1709,7 @@ fn workspace_unsatisfiable_member_dependencies_conflicting_threeway() -> Result<
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn workspace_unsatisfiable_member_dependencies_conflicting_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create the workspace root.
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1779,7 +1779,7 @@ fn workspace_unsatisfiable_member_dependencies_conflicting_extra() -> Result<()>
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn workspace_unsatisfiable_member_dependencies_conflicting_dev() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create the workspace root.
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1850,7 +1850,7 @@ fn workspace_unsatisfiable_member_dependencies_conflicting_dev() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-pypi")]
|
||||
fn workspace_member_name_shadows_dependencies() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Create the workspace root.
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -1922,7 +1922,7 @@ fn workspace_member_name_shadows_dependencies() -> Result<()> {
|
||||
/// the paths don't line up by accident.
|
||||
#[test]
|
||||
fn test_path_hopping() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build the main project ...
|
||||
let deps = indoc! {r#"
|
||||
@@ -1980,7 +1980,7 @@ fn test_path_hopping() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn transitive_dep_in_git_workspace_no_root() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2055,7 +2055,7 @@ fn transitive_dep_in_git_workspace_no_root() -> Result<()> {
|
||||
#[test]
|
||||
#[cfg(feature = "test-git")]
|
||||
fn transitive_dep_in_git_workspace_with_root() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
@@ -2120,7 +2120,7 @@ fn transitive_dep_in_git_workspace_with_root() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn workspace_members_with_leading_dot_slash() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build the main workspace with leading `./` in member paths
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -2190,7 +2190,7 @@ fn workspace_members_with_leading_dot_slash() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn workspace_members_with_parent_directory() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build a workspace with a member outside its directory using `../`
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
@@ -2235,7 +2235,7 @@ fn workspace_members_with_parent_directory() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn workspace_members_with_complex_relative_paths() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Build a workspace with complex relative path normalization
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
@@ -2,12 +2,12 @@ use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use crate::common::{TestContext, copy_dir_ignore, uv_snapshot};
|
||||
use uv_test::{copy_dir_ignore, uv_snapshot};
|
||||
|
||||
/// Test basic output for a simple workspace with one member.
|
||||
#[test]
|
||||
fn workspace_dir_simple() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Initialize a workspace with one member
|
||||
context.init().arg("foo").assert().success();
|
||||
@@ -29,7 +29,7 @@ fn workspace_dir_simple() {
|
||||
/// Workspace dir output when run with `--package`.
|
||||
#[test]
|
||||
fn workspace_dir_specific_package() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
context.init().arg("foo").assert().success();
|
||||
context.init().arg("foo/bar").assert().success();
|
||||
let workspace = context.temp_dir.child("foo");
|
||||
@@ -62,7 +62,7 @@ fn workspace_dir_specific_package() {
|
||||
/// Test output when run from a workspace member directory.
|
||||
#[test]
|
||||
fn workspace_metadata_from_member() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
let albatross_workspace = context
|
||||
@@ -90,7 +90,7 @@ fn workspace_metadata_from_member() -> Result<()> {
|
||||
/// Test workspace dir error output for a non-existent package.
|
||||
#[test]
|
||||
fn workspace_dir_package_doesnt_exist() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Initialize a workspace with one member
|
||||
context.init().arg("foo").assert().success();
|
||||
@@ -111,7 +111,7 @@ fn workspace_dir_package_doesnt_exist() {
|
||||
/// Test workspace dir error output when not in a project.
|
||||
#[test]
|
||||
fn workspace_metadata_no_project() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.workspace_dir(), @r"
|
||||
success: false
|
||||
|
||||
@@ -2,12 +2,12 @@ use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use crate::common::{TestContext, copy_dir_ignore, uv_snapshot};
|
||||
use uv_test::{copy_dir_ignore, uv_snapshot};
|
||||
|
||||
/// Test basic list output for a simple workspace with one member.
|
||||
#[test]
|
||||
fn workspace_list_simple() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Initialize a workspace with one member
|
||||
context.init().arg("foo").assert().success();
|
||||
@@ -40,7 +40,7 @@ fn workspace_list_simple() {
|
||||
/// Test list output for a root workspace (workspace with a root package).
|
||||
#[test]
|
||||
fn workspace_list_root_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -69,7 +69,7 @@ fn workspace_list_root_workspace() -> Result<()> {
|
||||
/// Test list output for a virtual workspace (no root package).
|
||||
#[test]
|
||||
fn workspace_list_virtual_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -98,7 +98,7 @@ fn workspace_list_virtual_workspace() -> Result<()> {
|
||||
/// Test list output when run from a workspace member directory.
|
||||
#[test]
|
||||
fn workspace_list_from_member() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -129,7 +129,7 @@ fn workspace_list_from_member() -> Result<()> {
|
||||
/// Test list output for a workspace with multiple packages.
|
||||
#[test]
|
||||
fn workspace_list_multiple_members() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Initialize workspace root
|
||||
context.init().arg("pkg-a").assert().success();
|
||||
@@ -181,7 +181,7 @@ fn workspace_list_multiple_members() {
|
||||
/// Test list output for a single project (not a workspace).
|
||||
#[test]
|
||||
fn workspace_list_single_project() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.init().arg("my-project").assert().success();
|
||||
|
||||
@@ -202,7 +202,7 @@ fn workspace_list_single_project() {
|
||||
/// Test list output with excluded packages.
|
||||
#[test]
|
||||
fn workspace_list_with_excluded() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -229,7 +229,7 @@ fn workspace_list_with_excluded() -> Result<()> {
|
||||
/// Test list error output when not in a project.
|
||||
#[test]
|
||||
fn workspace_list_no_project() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.workspace_list(), @r"
|
||||
success: false
|
||||
|
||||
@@ -2,12 +2,12 @@ use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use crate::common::{TestContext, copy_dir_ignore, uv_snapshot};
|
||||
use uv_test::{copy_dir_ignore, uv_snapshot};
|
||||
|
||||
/// Test basic metadata output for a simple workspace with one member.
|
||||
#[test]
|
||||
fn workspace_metadata_simple() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Initialize a workspace with one member
|
||||
context.init().arg("foo").assert().success();
|
||||
@@ -40,7 +40,7 @@ fn workspace_metadata_simple() {
|
||||
/// Test metadata for a root workspace (workspace with a root package).
|
||||
#[test]
|
||||
fn workspace_metadata_root_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -86,7 +86,7 @@ fn workspace_metadata_root_workspace() -> Result<()> {
|
||||
/// Test metadata for a virtual workspace (no root package).
|
||||
#[test]
|
||||
fn workspace_metadata_virtual_workspace() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -132,7 +132,7 @@ fn workspace_metadata_virtual_workspace() -> Result<()> {
|
||||
/// Test metadata when run from a workspace member directory.
|
||||
#[test]
|
||||
fn workspace_metadata_from_member() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -180,7 +180,7 @@ fn workspace_metadata_from_member() -> Result<()> {
|
||||
/// Test metadata for a workspace with multiple packages.
|
||||
#[test]
|
||||
fn workspace_metadata_multiple_members() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
// Initialize workspace root
|
||||
context.init().arg("pkg-a").assert().success();
|
||||
@@ -236,7 +236,7 @@ fn workspace_metadata_multiple_members() {
|
||||
/// Test metadata for a single project (not a workspace).
|
||||
#[test]
|
||||
fn workspace_metadata_single_project() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
context.init().arg("my-project").assert().success();
|
||||
|
||||
@@ -268,7 +268,7 @@ fn workspace_metadata_single_project() {
|
||||
/// Test metadata with excluded packages.
|
||||
#[test]
|
||||
fn workspace_metadata_with_excluded() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
let workspace = context.temp_dir.child("workspace");
|
||||
|
||||
copy_dir_ignore(
|
||||
@@ -306,7 +306,7 @@ fn workspace_metadata_with_excluded() -> Result<()> {
|
||||
/// Test metadata error when not in a project.
|
||||
#[test]
|
||||
fn workspace_metadata_no_project() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = uv_test::test_context!("3.12");
|
||||
|
||||
uv_snapshot!(context.filters(), context.workspace_metadata(), @"
|
||||
success: false
|
||||
|
||||
@@ -15,7 +15,7 @@ use predicates::prelude::predicate;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{
|
||||
use uv_test::{
|
||||
TestContext, build_vendor_links_url, get_bin, packse_index_url, python_path_with_versions,
|
||||
uv_snapshot,
|
||||
};
|
||||
@@ -55,7 +55,7 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
|
||||
{{/python_patch}}
|
||||
#[test]
|
||||
fn {{module_name}}() -> Result<()> {
|
||||
let context = TestContext::new("{{environment.python}}");
|
||||
let context = uv_test::test_context!("{{environment.python}}");
|
||||
let python_versions = &[{{#environment.additional_python}}"{{.}}", {{/environment.additional_python}}];
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::process::Command;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, build_vendor_links_url, packse_index_url, uv_snapshot};
|
||||
use uv_test::{TestContext, build_vendor_links_url, packse_index_url, uv_snapshot};
|
||||
|
||||
/// Create a `pip install` command with options shared across all scenarios.
|
||||
fn command(context: &TestContext) -> Command {
|
||||
@@ -38,7 +38,7 @@ fn command(context: &TestContext) -> Command {
|
||||
{{/python_patch}}
|
||||
#[test]
|
||||
fn {{module_name}}() {
|
||||
let context = TestContext::new("{{environment.python}}");
|
||||
let context = uv_test::test_context!("{{environment.python}}");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
|
||||
@@ -15,7 +15,7 @@ use insta::assert_snapshot;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{TestContext, packse_index_url, uv_snapshot};
|
||||
use uv_test::{packse_index_url, uv_snapshot};
|
||||
|
||||
{{#scenarios}}
|
||||
|
||||
@@ -29,7 +29,7 @@ use crate::common::{TestContext, packse_index_url, uv_snapshot};
|
||||
/// ```
|
||||
#[test]
|
||||
fn {{module_name}}() -> Result<()> {
|
||||
let context = TestContext::new("{{environment.python}}");
|
||||
let context = uv_test::test_context!("{{environment.python}}");
|
||||
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = context.filters();
|
||||
|
||||
Reference in New Issue
Block a user