}
}
}
+
#[test]
fn with_retry_repeats_the_call_then_works() {
+ use crate::core::Shell;
+
//Error HTTP codes (5xx) are considered maybe_spurious and will prompt retry
let error1 = HttpNot200 {
code: 501,
.into();
let mut results: Vec<CargoResult<()>> = vec![Ok(()), Err(error1), Err(error2)];
let config = Config::default().unwrap();
+ *config.shell() = Shell::from_write(Box::new(Vec::new()));
let result = with_retry(&config, || results.pop().unwrap());
assert_eq!(result.unwrap(), ())
}
#[test]
fn with_retry_finds_nested_spurious_errors() {
+ use crate::core::Shell;
+
//Error HTTP codes (5xx) are considered maybe_spurious and will prompt retry
//String error messages are not considered spurious
let error1 = failure::Error::from(HttpNot200 {
let error2 = failure::Error::from(error2.context("A second chained error"));
let mut results: Vec<CargoResult<()>> = vec![Ok(()), Err(error1), Err(error2)];
let config = Config::default().unwrap();
+ *config.shell() = Shell::from_write(Box::new(Vec::new()));
let result = with_retry(&config, || results.pop().unwrap());
assert_eq!(result.unwrap(), ())
}
// Prevent this test from accessing the network by setting up .cargo/config.
registry::init();
- let config = Config::new(Shell::new(), cargo_home(), cargo_home());
+ let config = Config::new(
+ Shell::from_write(Box::new(Vec::new())),
+ cargo_home(),
+ cargo_home(),
+ );
let ws = Workspace::new(&p.root().join("Cargo.toml"), &config).unwrap();
let compile_options = CompileOptions::new(&config, CompileMode::Build).unwrap();
let member_bar = ws.members().find(|m| &*m.name() == "bar").unwrap();
#[cargo_test]
fn finds_local_author_git() {
- git_process("init").exec().unwrap();
+ git_process("init").exec_with_output().unwrap();
git_process("config --global user.name foo").exec().unwrap();
git_process("config --global user.email foo@bar")
.exec()
use cargo::util::Config;
let sid = SourceId::for_registry(®istry_url()).unwrap();
- let cfg = Config::new(Shell::new(), paths::root(), paths::home().join(".cargo"));
+ let cfg = Config::new(
+ Shell::from_write(Box::new(Vec::new())),
+ paths::root(),
+ paths::home().join(".cargo"),
+ );
let lock = cfg.acquire_package_cache_lock().unwrap();
let mut regsrc = RegistrySource::remote(sid, &HashSet::new(), &cfg);
regsrc.update().unwrap();