Skip to content

Commit 32d0536

Browse files
committed
Try conditionally looking which directory these live in
1 parent b2637f0 commit 32d0536

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

tests/bindings.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::{ffi::OsStr, path::Path};
1+
use std::{
2+
ffi::OsStr,
3+
path::{Path, PathBuf},
4+
};
25

36
use assert_cmd::{assert::Assert, Command};
47
use fs_extra::dir::CopyOptions;
@@ -143,13 +146,13 @@ where
143146
.assert()
144147
.success();
145148

146-
Command::new(path.join(".venv").join("bin").join("pip"))
149+
Command::new(venv_path(path).join("pip"))
147150
.current_dir(path)
148151
.args(["install", "mypy"])
149152
.assert()
150153
.success();
151154

152-
Command::new(path.join(".venv").join("bin").join("mypy"))
155+
Command::new(venv_path(path).join("mypy"))
153156
.current_dir(path)
154157
.args(args)
155158
.assert()
@@ -159,6 +162,11 @@ where
159162
)
160163
}
161164

165+
fn venv_path(path: &Path) -> PathBuf {
166+
path.join(".venv")
167+
.join(if cfg!(windows) { "Scripts" } else { "bin" })
168+
}
169+
162170
fn install_numpy(path: &Path) {
163171
Command::new("curl")
164172
.current_dir(path)

tests/componentize.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
use std::{io::Write, path::Path, process::Stdio};
1+
use std::{
2+
io::Write,
3+
path::{Path, PathBuf},
4+
process::Stdio,
5+
};
26

37
use assert_cmd::Command;
48
use fs_extra::dir::CopyOptions;
@@ -195,13 +199,13 @@ fn sandbox_example() -> anyhow::Result<()> {
195199
.assert()
196200
.success();
197201

198-
Command::new(path.join(".venv").join("bin").join("pip"))
202+
Command::new(venv_path(&path).join("pip"))
199203
.current_dir(&path)
200204
.args(["install", "wasmtime"])
201205
.assert()
202206
.success();
203207

204-
Command::new(path.join(".venv").join("bin").join("python"))
208+
Command::new(venv_path(&path).join("python"))
205209
.current_dir(&path)
206210
.args([
207211
"-m",
@@ -213,7 +217,7 @@ fn sandbox_example() -> anyhow::Result<()> {
213217
.assert()
214218
.success();
215219

216-
Command::new(path.join(".venv").join("bin").join("python"))
220+
Command::new(venv_path(&path).join("python"))
217221
.current_dir(&path)
218222
.args(["host.py", "2 + 2"])
219223
.assert()
@@ -282,6 +286,11 @@ fn tcp_example() -> anyhow::Result<()> {
282286
Ok(())
283287
}
284288

289+
fn venv_path(path: &Path) -> PathBuf {
290+
path.join(".venv")
291+
.join(if cfg!(windows) { "Scripts" } else { "bin" })
292+
}
293+
285294
fn install_numpy(path: &Path) {
286295
Command::new("curl")
287296
.current_dir(path)

0 commit comments

Comments
 (0)