mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
Fix the search path tests on MacOS (#12503)
This commit is contained in:
parent
2a64cccb61
commit
2ce3e3ae60
1 changed files with 9 additions and 20 deletions
|
@ -118,29 +118,18 @@ where
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let workspace_path = temp_dir.path().join("workspace");
|
let root_path = SystemPathBuf::from_utf8_path_buf(
|
||||||
|
root_path
|
||||||
std::fs::create_dir_all(&workspace_path).with_context(|| {
|
|
||||||
format!(
|
|
||||||
"Failed to create workspace directory '{}'",
|
|
||||||
workspace_path.display()
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let workspace_path = SystemPath::from_std_path(&workspace_path).ok_or_else(|| {
|
|
||||||
anyhow!(
|
|
||||||
"Workspace root '{}' in temp directory is not a valid UTF-8 path.",
|
|
||||||
workspace_path.display()
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let workspace_path = SystemPathBuf::from_utf8_path_buf(
|
|
||||||
workspace_path
|
|
||||||
.as_utf8_path()
|
.as_utf8_path()
|
||||||
.canonicalize_utf8()
|
.canonicalize_utf8()
|
||||||
.with_context(|| "Failed to canonicalize workspace path.")?,
|
.with_context(|| "Failed to canonicalize root path.")?,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let workspace_path = root_path.join("workspace");
|
||||||
|
|
||||||
|
std::fs::create_dir_all(workspace_path.as_std_path())
|
||||||
|
.with_context(|| format!("Failed to create workspace directory '{workspace_path}'",))?;
|
||||||
|
|
||||||
for (relative_path, content) in workspace_files {
|
for (relative_path, content) in workspace_files {
|
||||||
let relative_path = relative_path.as_ref();
|
let relative_path = relative_path.as_ref();
|
||||||
let absolute_path = workspace_path.join(relative_path);
|
let absolute_path = workspace_path.join(relative_path);
|
||||||
|
@ -157,7 +146,7 @@ where
|
||||||
let system = OsSystem::new(&workspace_path);
|
let system = OsSystem::new(&workspace_path);
|
||||||
|
|
||||||
let workspace = WorkspaceMetadata::from_path(&workspace_path, &system)?;
|
let workspace = WorkspaceMetadata::from_path(&workspace_path, &system)?;
|
||||||
let search_paths = create_search_paths(root_path, workspace.root());
|
let search_paths = create_search_paths(&root_path, workspace.root());
|
||||||
|
|
||||||
for path in search_paths
|
for path in search_paths
|
||||||
.extra_paths
|
.extra_paths
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue