Skip to content

Commit

Permalink
tests: make test unix only
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Jan 16, 2025
1 parent 5686cab commit 14e6294
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions crates/uv-settings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,6 @@ mod test {
#[test]
#[cfg(not(windows))]
fn test_locate_system_config_xdg() -> Result<(), FixtureError> {
use std::os::unix::fs::PermissionsExt;

// Write a `uv.toml` to a temporary directory.
let context = assert_fs::TempDir::new()?;
context.child("uv").child("uv.toml").write_str(indoc! {
Expand Down Expand Up @@ -357,17 +355,21 @@ mod test {
first_config.path()
);

// Try a permissions error
let second = context.child("second");
let second_config = first.child("uv").child("uv.toml");
second_config.write_str("")?;
second_config
.metadata()
.unwrap()
.permissions()
.set_mode(0o000);
Ok(())
}

#[test]
#[cfg(unix)]
fn test_locate_system_config_xdg_unix_permissions() -> Result<(), FixtureError> {
use std::os::unix::fs::PermissionsExt;

let context = assert_fs::TempDir::new()?;
let config = context.child("uv").child("uv.toml");
config.write_str("")?;
config.metadata().unwrap().permissions().set_mode(0o000);

assert_eq!(
locate_system_config_xdg(Some(second.to_str().unwrap())),
locate_system_config_xdg(Some(context.to_str().unwrap())),
None
);

Expand Down

0 comments on commit 14e6294

Please sign in to comment.