Skip to content

Commit

Permalink
Auto merge of #5119 - alexcrichton:no-clone-index-in-tests, r=matklad
Browse files Browse the repository at this point in the history
Update a test to not clone the real index

A local index should work ok!
  • Loading branch information
bors committed Mar 4, 2018
2 parents cd230ad + d6d1f3a commit 2659f40
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/testsuite/generate_lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use std::fs::{self, File};
use std::io::prelude::*;

use cargotest::support::{project, execs};
use cargotest::support::registry::Package;
use cargotest::ChannelChanger;
use hamcrest::{assert_that, existing_file, is_not};

#[test]
Expand Down Expand Up @@ -73,7 +75,8 @@ fn adding_and_removing_packages() {

#[test]
fn no_index_update() {
use cargotest::ChannelChanger;
Package::new("serde", "1.0.0").publish();

let p = project("foo")
.file("Cargo.toml", r#"
[package]
Expand All @@ -88,12 +91,12 @@ fn no_index_update() {
.build();

assert_that(p.cargo("generate-lockfile"),
execs().with_stdout("")
.with_stderr_contains(" Updating registry `https://github.com/rust-lang/crates.io-index`"));
execs().with_stderr("\
[UPDATING] registry `[..]`
"));

assert_that(p.cargo("generate-lockfile").masquerade_as_nightly_cargo().arg("-Zno-index-update"),
execs().with_status(0).with_stdout("")
.with_stderr_does_not_contain(" Updating registry `https://github.com/rust-lang/crates.io-index`"));
execs().with_status(0).with_stdout("").with_stderr(""));
}

#[test]
Expand Down

0 comments on commit 2659f40

Please sign in to comment.