Skip to content

Commit b9b5a45

Browse files
committed
Auto merge of #12184 - epage:rm, r=weihanglo
refactor(tests): Reduce cargo-remove setup load This reduces the number of packages published in tests. This is an artifact of when I changed `cargo-edit` from relying on crates.io to test-generated published packages. I took the fastest path to making that conversion and took the shortcut of creating everything for every test. I had assumed the cost was low but `@Muscraft` noticed that this takes up a lot of space which we run out of on CI occasionally and I expect a lot of small files are slowing down windows. This only updates `cargo-remove`. I'll be doing a follow up for `cargo-add`.
2 parents 6d3a912 + ad9a44d commit b9b5a45

File tree

31 files changed

+396
-148
lines changed

31 files changed

+396
-148
lines changed

tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("semver", "0.1.1")
15+
.feature("std", &[])
16+
.publish();
17+
cargo_test_support::registry::Package::new("serde", "1.0.90")
18+
.feature("std", &[])
19+
.publish();
20+
1121
let project = Project::from_template(curr_dir!().join("in"));
1222
let project_root = project.root();
1323
let cwd = &project_root;

tests/testsuite/cargo_remove/build/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("semver", "0.1.1")
15+
.feature("std", &[])
16+
.publish();
17+
cargo_test_support::registry::Package::new("serde", "1.0.90")
18+
.feature("std", &[])
19+
.publish();
20+
1121
let project = Project::from_template(curr_dir!().join("in"));
1222
let project_root = project.root();
1323
let cwd = &project_root;

tests/testsuite/cargo_remove/dev/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("semver", "0.1.1")
15+
.feature("std", &[])
16+
.publish();
17+
cargo_test_support::registry::Package::new("serde", "1.0.90")
18+
.feature("std", &[])
19+
.publish();
20+
1121
let project = Project::from_template(curr_dir!().join("in"));
1222
let project_root = project.root();
1323
let cwd = &project_root;

tests/testsuite/cargo_remove/dry_run/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("semver", "0.1.1")
15+
.feature("std", &[])
16+
.publish();
17+
cargo_test_support::registry::Package::new("serde", "1.0.90")
18+
.feature("std", &[])
19+
.publish();
20+
1121
let project = Project::from_template(curr_dir!().join("in"));
1222
let project_root = project.root();
1323
let cwd = &project_root;

tests/testsuite/cargo_remove/gc_patch/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ use cargo_test_support::git;
55
use cargo_test_support::project;
66
use cargo_test_support::CargoCommand;
77

8-
use crate::cargo_remove::init_registry;
9-
108
#[cargo_test]
119
fn case() {
12-
init_registry();
10+
cargo_test_support::registry::init();
1311

1412
let git_project1 = git::new("bar1", |project| {
1513
project

tests/testsuite/cargo_remove/gc_profile/mod.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("toml", "0.2.3+my-package").publish();
15+
cargo_test_support::registry::Package::new("semver", "0.1.1")
16+
.feature("std", &[])
17+
.publish();
18+
cargo_test_support::registry::Package::new("serde", "1.0.90")
19+
.feature("std", &[])
20+
.publish();
21+
1122
let project = Project::from_template(curr_dir!().join("in"));
1223
let project_root = project.root();
1324
let cwd = &project_root;

tests/testsuite/cargo_remove/gc_replace/mod.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("toml", "0.2.3+my-package").publish();
15+
cargo_test_support::registry::Package::new("semver", "0.1.1")
16+
.feature("std", &[])
17+
.publish();
18+
cargo_test_support::registry::Package::new("serde", "1.0.90")
19+
.feature("std", &[])
20+
.publish();
21+
1122
let project = Project::from_template(curr_dir!().join("in"));
1223
let project_root = project.root();
1324
let cwd = &project_root;

tests/testsuite/cargo_remove/invalid_arg/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("semver", "0.1.1")
15+
.feature("std", &[])
16+
.publish();
17+
cargo_test_support::registry::Package::new("serde", "1.0.90")
18+
.feature("std", &[])
19+
.publish();
20+
1121
let project = Project::from_template(curr_dir!().join("in"));
1222
let project_root = project.root();
1323
let cwd = &project_root;

tests/testsuite/cargo_remove/invalid_dep/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("semver", "0.1.1")
15+
.feature("std", &[])
16+
.publish();
17+
cargo_test_support::registry::Package::new("serde", "1.0.90")
18+
.feature("std", &[])
19+
.publish();
20+
1121
let project = Project::from_template(curr_dir!().join("in"));
1222
let project_root = project.root();
1323
let cwd = &project_root;

tests/testsuite/cargo_remove/invalid_package/mod.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
12+
cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
15+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
16+
cargo_test_support::registry::Package::new("semver", "0.1.1")
17+
.feature("std", &[])
18+
.publish();
19+
cargo_test_support::registry::Package::new("serde", "1.0.90")
20+
.feature("std", &[])
21+
.publish();
22+
1123
let project = Project::from_template(curr_dir!().join("in"));
1224
let project_root = project.root();
1325
let cwd = &project_root;

tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
12+
cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
15+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
16+
cargo_test_support::registry::Package::new("semver", "0.1.1")
17+
.feature("std", &[])
18+
.publish();
19+
cargo_test_support::registry::Package::new("serde", "1.0.90")
20+
.feature("std", &[])
21+
.publish();
22+
1123
let project = Project::from_template(curr_dir!().join("in"));
1224
let project_root = project.root();
1325
let cwd = &project_root;

tests/testsuite/cargo_remove/invalid_section/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("semver", "0.1.1")
15+
.feature("std", &[])
16+
.publish();
17+
cargo_test_support::registry::Package::new("serde", "1.0.90")
18+
.feature("std", &[])
19+
.publish();
20+
1121
let project = Project::from_template(curr_dir!().join("in"));
1222
let project_root = project.root();
1323
let cwd = &project_root;

tests/testsuite/cargo_remove/invalid_section_dep/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
12+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("semver", "0.1.1")
15+
.feature("std", &[])
16+
.publish();
17+
cargo_test_support::registry::Package::new("serde", "1.0.90")
18+
.feature("std", &[])
19+
.publish();
20+
1121
let project = Project::from_template(curr_dir!().join("in"));
1222
let project_root = project.root();
1323
let cwd = &project_root;

tests/testsuite/cargo_remove/invalid_target/mod.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
12+
cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
15+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
16+
cargo_test_support::registry::Package::new("semver", "0.1.1")
17+
.feature("std", &[])
18+
.publish();
19+
cargo_test_support::registry::Package::new("serde", "1.0.90")
20+
.feature("std", &[])
21+
.publish();
22+
1123
let project = Project::from_template(curr_dir!().join("in"));
1224
let project_root = project.root();
1325
let cwd = &project_root;

tests/testsuite/cargo_remove/invalid_target_dep/mod.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@ use cargo_test_support::curr_dir;
33
use cargo_test_support::CargoCommand;
44
use cargo_test_support::Project;
55

6-
use crate::cargo_remove::init_registry;
7-
86
#[cargo_test]
97
fn case() {
10-
init_registry();
8+
cargo_test_support::registry::init();
9+
cargo_test_support::registry::Package::new("clippy", "0.4.0+my-package").publish();
10+
cargo_test_support::registry::Package::new("dbus", "0.6.2+my-package").publish();
11+
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
12+
cargo_test_support::registry::Package::new("ncurses", "20.0.0+my-package").publish();
13+
cargo_test_support::registry::Package::new("regex", "0.1.1+my-package").publish();
14+
cargo_test_support::registry::Package::new("rustc-serialize", "0.4.0+my-package").publish();
15+
cargo_test_support::registry::Package::new("toml", "0.1.1+my-package").publish();
16+
cargo_test_support::registry::Package::new("semver", "0.1.1")
17+
.feature("std", &[])
18+
.publish();
19+
cargo_test_support::registry::Package::new("serde", "1.0.90")
20+
.feature("std", &[])
21+
.publish();
22+
1123
let project = Project::from_template(curr_dir!().join("in"));
1224
let project_root = project.root();
1325
let cwd = &project_root;

0 commit comments

Comments
 (0)