mirror of
https://github.com/astral-sh/uv
synced 2026-06-21 13:47:25 +00:00
Fix tests
This commit is contained in:
@@ -45,6 +45,24 @@ pub trait Installable<'lock> {
|
||||
/// Return the [`PackageName`] of the target, if available.
|
||||
fn project_name(&self) -> Option<&PackageName>;
|
||||
|
||||
/// Convert the [`Lock`] to a [`Resolution`] using the given marker environment, tags, and
|
||||
/// root, without any extras, dependency groups, or install options.
|
||||
fn to_resolution_simple(
|
||||
&self,
|
||||
marker_env: &ResolverMarkerEnvironment,
|
||||
tags: &Tags,
|
||||
build_options: &BuildOptions,
|
||||
) -> Result<Resolution, LockError> {
|
||||
self.to_resolution(
|
||||
marker_env,
|
||||
tags,
|
||||
&ExtrasSpecificationWithDefaults::none(),
|
||||
&DependencyGroupsWithDefaults::none(),
|
||||
build_options,
|
||||
&InstallOptions::default(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Convert the [`Lock`] to a [`Resolution`] using the given marker environment, tags, and root.
|
||||
fn to_resolution(
|
||||
&self,
|
||||
|
||||
@@ -262,6 +262,19 @@ impl TestContext {
|
||||
self
|
||||
}
|
||||
|
||||
/// Filter `(compiled: yes)` and `(compiled: no)` to a consistent value.
|
||||
///
|
||||
/// Useful when `--python-platform` forces a cross-platform resolution so the
|
||||
/// installed wheel may or may not be native depending on the host.
|
||||
#[must_use]
|
||||
pub fn with_filtered_compiled(mut self) -> Self {
|
||||
self.filters.push((
|
||||
r"compiled: (yes|no)".to_string(),
|
||||
"compiled: [COMPILED]".to_string(),
|
||||
));
|
||||
self
|
||||
}
|
||||
|
||||
/// Add extra standard filtering for Python interpreter sources
|
||||
#[must_use]
|
||||
pub fn with_filtered_python_sources(mut self) -> Self {
|
||||
|
||||
@@ -2149,6 +2149,7 @@ pub(crate) async fn resolve_environment(
|
||||
.index_strategy(*index_strategy)
|
||||
.build_options(build_options.clone())
|
||||
.build();
|
||||
|
||||
// TODO(charlie): These are all default values. We should consider whether we want to make them
|
||||
// optional on the downstream APIs.
|
||||
let extras = ExtrasSpecification::default();
|
||||
|
||||
@@ -10,9 +10,7 @@ use uv_cache::{Cache, Refresh};
|
||||
use uv_cache_info::Timestamp;
|
||||
use uv_client::{BaseClientBuilder, RegistryClientBuilder};
|
||||
use uv_configuration::{
|
||||
Concurrency, Constraints, DependencyGroupsWithDefaults, DryRun,
|
||||
ExtrasSpecificationWithDefaults, GitLfsSetting, InstallOptions, Reinstall, TargetTriple,
|
||||
Upgrade,
|
||||
Concurrency, Constraints, DryRun, GitLfsSetting, Reinstall, TargetTriple, Upgrade,
|
||||
};
|
||||
use uv_distribution::LoweredExtraBuildDependencies;
|
||||
use uv_distribution_types::{
|
||||
@@ -622,13 +620,10 @@ pub(crate) async fn install(
|
||||
.target_requirement()
|
||||
.map(|requirement| &requirement.name),
|
||||
)
|
||||
.to_resolution(
|
||||
.to_resolution_simple(
|
||||
&markers,
|
||||
&tags,
|
||||
&ExtrasSpecificationWithDefaults::none(),
|
||||
&DependencyGroupsWithDefaults::none(),
|
||||
&settings.resolver.build_options,
|
||||
&InstallOptions::default(),
|
||||
)?;
|
||||
Planner::new(&resolution)
|
||||
.build(
|
||||
|
||||
@@ -391,11 +391,10 @@ async fn upgrade_tool(
|
||||
&resolution,
|
||||
&receipt_manifest,
|
||||
);
|
||||
let resolution = resolution.into();
|
||||
|
||||
let environment = sync_environment(
|
||||
environment,
|
||||
&resolution,
|
||||
&resolution.into(),
|
||||
Modifications::Exact,
|
||||
build_constraints,
|
||||
(&settings).into(),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -354,6 +354,8 @@ fn tool_list_deprecated() -> Result<()> {
|
||||
// Install `black`
|
||||
context
|
||||
.tool_install()
|
||||
.arg("--python-platform")
|
||||
.arg("linux")
|
||||
.arg("black==24.2.0")
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
|
||||
@@ -572,6 +572,8 @@ fn tool_upgrade_recomputes_relative_exclude_newer() {
|
||||
|
||||
context
|
||||
.tool_install()
|
||||
.arg("--python-platform")
|
||||
.arg("linux")
|
||||
.arg("black")
|
||||
.arg("--exclude-newer")
|
||||
.arg("3 weeks")
|
||||
@@ -584,6 +586,8 @@ fn tool_upgrade_recomputes_relative_exclude_newer() {
|
||||
.success();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_upgrade()
|
||||
.arg("--python-platform")
|
||||
.arg("linux")
|
||||
.arg("black")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_TEST_CURRENT_TIMESTAMP, "2024-04-15T00:00:00Z")
|
||||
|
||||
Reference in New Issue
Block a user