Skip to content

Commit

Permalink
Use differnt test dir
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Aug 23, 2024
1 parent 4f5700f commit 8d9f313
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 32 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/uv-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ anyhow = { workspace = true }
fs-err = { workspace = true }
futures = { workspace = true }
nanoid = { workspace = true }
path-absolutize = { workspace = true }
reqwest = { workspace = true }
reqwest-middleware = { workspace = true }
rmp-serde = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion crates/uv-distribution/src/metadata/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::BTreeMap;
use std::io;
use std::path::{Path, PathBuf};

use path_absolutize::Absolutize;
use thiserror::Error;
use url::Url;

Expand Down
16 changes: 3 additions & 13 deletions crates/uv-fs/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ use path_slash::PathExt;

/// The current working directory.
pub static CWD: LazyLock<PathBuf> =
LazyLock::new(|| {
std::env::var("UV_CWD")
.ok()
.map(PathBuf::from)
.unwrap_or_else(|| std::env::current_dir().expect("The current directory must exist"))
});
LazyLock::new(|| std::env::current_dir().expect("The current directory must exist"));

/// The current working directory, canonicalized.
pub static CANONICAL_CWD: LazyLock<PathBuf> = LazyLock::new(|| {
std::env::var("UV_CWD")
.ok()
.map(PathBuf::from)
.unwrap_or_else(|| std::env::current_dir().expect("The current directory must exist"))
std::env::current_dir()
.expect("The current directory must exist")
.canonicalize()
.expect("The current directory must be canonicalized")
});
Expand Down Expand Up @@ -281,9 +274,6 @@ pub fn relative_to(
path: impl AsRef<Path>,
base: impl AsRef<Path>,
) -> Result<PathBuf, std::io::Error> {
// println!("path: {}", path.as_ref().display());
// println!("base: {}", base.as_ref().display());

// Find the longest common prefix, and also return the path stripped from that prefix
let (stripped, common_prefix) = base
.as_ref()
Expand Down
3 changes: 0 additions & 3 deletions crates/uv-resolver/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1928,9 +1928,6 @@ impl Source {
}

fn from_path_source_dist(path_dist: &PathSourceDist, root: &Path) -> Result<Source, LockError> {



let path = relative_to(&path_dist.install_path, root)
.map_err(LockErrorKind::DistributionRelativePath)?;

Expand Down
2 changes: 0 additions & 2 deletions crates/uv-workspace/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ impl Workspace {
pyproject_toml,
});



Self::collect_members(
workspace_root.clone(),
workspace_definition,
Expand Down
3 changes: 1 addition & 2 deletions crates/uv/src/commands/project/lock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(clippy::single_match_else)]

use std::collections::BTreeSet;
use std::env;
use std::fmt::Write;

use anstream::eprint;
Expand Down Expand Up @@ -77,7 +76,7 @@ pub(crate) async fn lock(
printer: Printer,
) -> anyhow::Result<ExitStatus> {
// Find the project requirements.
let workspace = Workspace::discover(&*CWD, &DiscoveryOptions::default()).await?;
let workspace = Workspace::discover(&CWD, &DiscoveryOptions::default()).await?;

// Find an interpreter for the project
let interpreter = FoundInterpreter::discover(
Expand Down
4 changes: 0 additions & 4 deletions crates/uv/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ impl TestContext {
let canonical_temp_dir = temp_dir.canonicalize().unwrap();
let venv = ChildPath::new(canonical_temp_dir.join(".venv"));

println!("temp_dir: {:?}", temp_dir.path());
println!("canonical_temp_dir: {:?}", canonical_temp_dir);

let python_version = python_versions
.first()
.map(|version| PythonVersion::from_str(version).unwrap());
Expand Down Expand Up @@ -396,7 +393,6 @@ impl TestContext {
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
.env("UV_CWD", self.temp_dir.path())
.current_dir(self.temp_dir.path());
println!("current_dir: {:?}", self.temp_dir.path());

if cfg!(all(windows, debug_assertions)) {
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
Expand Down
8 changes: 3 additions & 5 deletions crates/uv/tests/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7106,8 +7106,6 @@ fn lock_sources_archive() -> Result<()> {
let mut workspace_archive_file = fs_err::File::create(&*workspace_archive)?;
std::io::copy(&mut response.bytes()?.as_ref(), &mut workspace_archive_file)?;



let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(&formatdoc! {
r#"
Expand All @@ -7134,8 +7132,8 @@ fn lock_sources_archive() -> Result<()> {
// insta::with_settings!({
// filters => context.filters(),
// }, {
assert_snapshot!(
lock, @r###"
assert_snapshot!(
lock, @r###"
version = 1
requires-python = ">=3.12"
Expand Down Expand Up @@ -7195,7 +7193,7 @@ fn lock_sources_archive() -> Result<()> {
[package.metadata]
requires-dist = [{ name = "anyio" }]
"###
);
);
// });

// Re-run with `--locked`.
Expand Down

0 comments on commit 8d9f313

Please sign in to comment.