Skip to content

Commit 2ce3e3a

Browse files
authored
Fix the search path tests on MacOS (#12503)
1 parent 2a64ccc commit 2ce3e3a

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

crates/red_knot/tests/file_watching.rs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -118,29 +118,18 @@ where
118118
)
119119
})?;
120120

121-
let workspace_path = temp_dir.path().join("workspace");
122-
123-
std::fs::create_dir_all(&workspace_path).with_context(|| {
124-
format!(
125-
"Failed to create workspace directory '{}'",
126-
workspace_path.display()
127-
)
128-
})?;
129-
130-
let workspace_path = SystemPath::from_std_path(&workspace_path).ok_or_else(|| {
131-
anyhow!(
132-
"Workspace root '{}' in temp directory is not a valid UTF-8 path.",
133-
workspace_path.display()
134-
)
135-
})?;
136-
137-
let workspace_path = SystemPathBuf::from_utf8_path_buf(
138-
workspace_path
121+
let root_path = SystemPathBuf::from_utf8_path_buf(
122+
root_path
139123
.as_utf8_path()
140124
.canonicalize_utf8()
141-
.with_context(|| "Failed to canonicalize workspace path.")?,
125+
.with_context(|| "Failed to canonicalize root path.")?,
142126
);
143127

128+
let workspace_path = root_path.join("workspace");
129+
130+
std::fs::create_dir_all(workspace_path.as_std_path())
131+
.with_context(|| format!("Failed to create workspace directory '{workspace_path}'",))?;
132+
144133
for (relative_path, content) in workspace_files {
145134
let relative_path = relative_path.as_ref();
146135
let absolute_path = workspace_path.join(relative_path);
@@ -157,7 +146,7 @@ where
157146
let system = OsSystem::new(&workspace_path);
158147

159148
let workspace = WorkspaceMetadata::from_path(&workspace_path, &system)?;
160-
let search_paths = create_search_paths(root_path, workspace.root());
149+
let search_paths = create_search_paths(&root_path, workspace.root());
161150

162151
for path in search_paths
163152
.extra_paths

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy