Use Default Configuration for Tests
Uses the default configuration for tests, in order to not mess up test cases with different configurations in the config file.
This commit is contained in:
parent
a4430bf158
commit
ca014d7aac
1 changed files with 8 additions and 0 deletions
|
|
@ -79,6 +79,7 @@ impl Config {
|
|||
}
|
||||
|
||||
/// Entry point of the configuration
|
||||
#[cfg(not(test))]
|
||||
pub fn from_cli_config(cli_config: Option<ConfigCli>) -> ConfigResult {
|
||||
match cli_config {
|
||||
Some(ConfigCli::Config { clean, .. }) if clean => Ok(Config::default()),
|
||||
|
|
@ -88,6 +89,13 @@ impl Config {
|
|||
Some(_) | None => Ok(Config::from_default_path()?),
|
||||
}
|
||||
}
|
||||
|
||||
//#[allow(unused_must_use)]
|
||||
/// In order not to mess up tests from changing configurations
|
||||
#[cfg(test)]
|
||||
pub fn from_cli_config(_: Option<ConfigCli>) -> ConfigResult {
|
||||
Ok(Config::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for ConfigError {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue