Skip to content

Commit

Permalink
Revert "A confirming test (should revert after test passed)"
Browse files Browse the repository at this point in the history
This reverts commit df5066d.
  • Loading branch information
j178 committed Oct 9, 2024
1 parent ab7b754 commit 3b0b21a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 127 deletions.
42 changes: 1 addition & 41 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/uv-cache/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::ffi::c_float;
use std::io;
use std::path::{Path, PathBuf};

Expand Down
4 changes: 0 additions & 4 deletions crates/uv-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,3 @@ thiserror = { workspace = true }
toml = { workspace = true }
toml_edit = { workspace = true }
tracing = { workspace = true }

[dev-dependencies]
directories = "5.0.1"
dirs-sys = "0.4.1"
82 changes: 0 additions & 82 deletions crates/uv-tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,85 +458,3 @@ pub fn entrypoint_paths(

Ok(entrypoints)
}

#[cfg(test)]
mod tests {
use etcetera::BaseStrategy;
use std::path::PathBuf;

fn dirs_before() -> (PathBuf, PathBuf, PathBuf, PathBuf) {
let data_dir = directories::ProjectDirs::from("", "", "uv")
.unwrap()
.data_dir()
.to_path_buf();

let cache_dir = directories::ProjectDirs::from("", "", "uv")
.unwrap()
.cache_dir()
.to_path_buf();

let config_dir = {
// On Windows, use, e.g., C:\Users\Alice\AppData\Roaming
#[cfg(windows)]
{
dirs_sys::known_folder_roaming_app_data()
}
// On Linux and macOS, use, e.g., /home/alice/.config.
#[cfg(not(windows))]
{
std::env::var_os("XDG_CONFIG_HOME")
.and_then(dirs_sys::is_absolute_path)
.or_else(|| dirs_sys::home_dir().map(|path| path.join(".config")))
}
};

let home_dir = {
#[cfg(windows)]
{
dirs_sys::known_folder_profile()
}
#[cfg(not(windows))]
{
dirs_sys::home_dir()
}
};

(data_dir, cache_dir, config_dir.unwrap(), home_dir.unwrap())
}

fn dirs_after() -> (PathBuf, PathBuf, PathBuf, PathBuf) {
let data_dir = etcetera::base_strategy::choose_native_strategy()
.unwrap()
.data_dir()
.join("uv");
let data_dir = if cfg!(windows) {
data_dir.join("data")
} else {
data_dir
};

let cache_dir = etcetera::base_strategy::choose_native_strategy()
.unwrap()
.cache_dir()
.join("uv");
let cache_dir = if cfg!(windows) {
cache_dir.join("cache")
} else {
cache_dir
};

let config_dir = etcetera::base_strategy::choose_base_strategy()
.unwrap()
.config_dir();
let home_dir = etcetera::home_dir().unwrap();

(data_dir, cache_dir, config_dir, home_dir)
}

#[test]
fn ensure_directory_not_changed() {
let before = dirs_before();
let after = dirs_after();
assert_eq!(before, after);
}
}

0 comments on commit 3b0b21a

Please sign in to comment.