Skip to content

Commit

Permalink
Add PYTHONPATH for test command (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpryer authored Mar 26, 2023
1 parent 8dcd121 commit 8bd7e61
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/huak/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,19 @@ pub fn test_project(config: &OperationConfig) -> HuakResult<()> {
}
let mut cmd = Command::new(venv.python_path());
make_venv_command(&mut cmd, &venv)?;
cmd.args(["-m", "pytest"]).args(
config
.trailing_command_parts
.as_ref()
.unwrap_or(&Vec::new()),
);
let python_path = if config.workspace_root.join("src").exists() {
config.workspace_root.join("src")
} else {
config.workspace_root.clone()
};
cmd.args(["-m", "pytest"])
.args(
config
.trailing_command_parts
.as_ref()
.unwrap_or(&Vec::new()),
)
.env("PYTHONPATH", python_path);
terminal.run_command(&mut cmd)
}

Expand Down

0 comments on commit 8bd7e61

Please sign in to comment.