Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the search path tests on MacOS #12503

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions crates/red_knot/tests/file_watching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,29 +118,18 @@ where
)
})?;

let workspace_path = temp_dir.path().join("workspace");

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
let root_path = SystemPathBuf::from_utf8_path_buf(
root_path
.as_utf8_path()
.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 {
let relative_path = relative_path.as_ref();
let absolute_path = workspace_path.join(relative_path);
Expand All @@ -157,7 +146,7 @@ where
let system = OsSystem::new(&workspace_path);

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
.extra_paths
Expand Down
Loading