Skip to content

Commit 4b07bf1

Browse files
committed
Try less relative paths for running venv executables
1 parent c7e3d8c commit 4b07bf1

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

tests/bindings.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ where
143143
.assert()
144144
.success();
145145

146-
Command::new(venv_executable_path("pip"))
146+
Command::new(path.join(".venv/bin/pip"))
147147
.current_dir(path)
148148
.args(["install", "mypy"])
149149
.assert()
150150
.success();
151151

152-
Command::new(venv_executable_path("mypy"))
152+
Command::new(path.join(".venv/bin/mypy"))
153153
.current_dir(path)
154154
.args(args)
155155
.assert()
@@ -159,13 +159,6 @@ where
159159
)
160160
}
161161

162-
fn venv_executable_path(executable: &str) -> String {
163-
format!(
164-
"./.venv/bin/{executable}{}",
165-
if cfg!(windows) { ".exe" } else { "" }
166-
)
167-
}
168-
169162
fn install_numpy(path: &Path) {
170163
Command::new("curl")
171164
.current_dir(path)

tests/componentize.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ fn sandbox_example() -> anyhow::Result<()> {
195195
.assert()
196196
.success();
197197

198-
Command::new(venv_executable_path("pip"))
198+
Command::new(path.join(".venv/bin/pip"))
199199
.current_dir(&path)
200200
.args(["install", "wasmtime"])
201201
.assert()
202202
.success();
203203

204-
Command::new(venv_executable_path("python"))
204+
Command::new(path.join(".venv/bin/python"))
205205
.current_dir(&path)
206206
.args([
207207
"-m",
@@ -213,7 +213,7 @@ fn sandbox_example() -> anyhow::Result<()> {
213213
.assert()
214214
.success();
215215

216-
Command::new(venv_executable_path("python"))
216+
Command::new(path.join(".venv/bin/python"))
217217
.current_dir(&path)
218218
.args(["host.py", "2 + 2"])
219219
.assert()
@@ -298,10 +298,3 @@ fn install_numpy(path: &Path) {
298298
.assert()
299299
.success();
300300
}
301-
302-
fn venv_executable_path(executable: &str) -> String {
303-
format!(
304-
"./.venv/bin/{executable}{}",
305-
if cfg!(windows) { ".exe" } else { "" }
306-
)
307-
}

0 commit comments

Comments
 (0)