Skip to content

Commit

Permalink
Try and fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Sep 6, 2024
1 parent 2d048b0 commit fd6698d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions crates/cli/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@ use tracing::{debug, instrument};

#[instrument(skip_all)]
pub fn detect_proto_env(cli: &CLI) -> AppResult<ProtoEnvironment> {
#[cfg(test)]
let mut env = {
let sandbox = env::var("PROTO_SANDBOX")
.map(|value| std::path::PathBuf::from(&value))
.expect("Missing sandbox root for testing!");

ProtoEnvironment::new_testing(&sandbox)?
let mut env = if let Ok(sandbox) = env::var("PROTO_SANDBOX") {
ProtoEnvironment::new_testing(&std::path::PathBuf::from(&sandbox))?
} else {
ProtoEnvironment::new()?
};

#[cfg(not(test))]
let mut env = ProtoEnvironment::new()?;

env.config_mode = cli.config_mode.unwrap_or(match cli.command {
Commands::Activate(_)
| Commands::Install(_)
Expand Down

0 comments on commit fd6698d

Please sign in to comment.