Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove/rework some redundant .cwd(p.root()) in tests #5987

Merged
merged 4 commits into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions tests/testsuite/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ fn install_path() {

cargo_process("install --path").arg(p.root()).run();
assert_has_installed_exe(cargo_home(), "foo");
cargo_process("install --path .")
.cwd(p.root())
p.cargo("install --path .")
.with_status(101)
.with_stderr(
"\
Expand Down Expand Up @@ -692,8 +691,7 @@ fn subcommand_works_out_of_the_box() {
fn installs_from_cwd_by_default() {
let p = project().file("src/main.rs", "fn main() {}").build();

cargo_process("install")
.cwd(p.root())
p.cargo("install")
.with_stderr_contains(
"warning: Using `cargo install` to install the binaries for the \
project in current working directory is deprecated, \
Expand Down Expand Up @@ -725,8 +723,7 @@ fn installs_from_cwd_with_2018_warnings() {
).file("src/main.rs", "fn main() {}")
.build();

cargo_process("install")
.cwd(p.root())
p.cargo("install")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr_contains(
Expand Down Expand Up @@ -1243,15 +1240,6 @@ fn install_ignores_cargo_config() {
pkg("bar", "0.0.1");

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
authors = []
"#,
)
.file(
".cargo/config",
r#"
Expand All @@ -1262,6 +1250,6 @@ fn install_ignores_cargo_config() {
.file("src/main.rs", "fn main() {}")
.build();

cargo_process("install bar").cwd(p.root()).with_status(0).run();
p.cargo("install bar").run();
assert_has_installed_exe(cargo_home(), "bar");
}
2 changes: 0 additions & 2 deletions tests/testsuite/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,6 @@ fn cargo_metadata_no_deps_cwd() {
.build();

p.cargo("metadata --no-deps")
.cwd(p.root())
.with_json(MANIFEST_OUTPUT)
.run();
}
Expand All @@ -916,7 +915,6 @@ fn cargo_metadata_bad_version() {
.build();

p.cargo("metadata --no-deps --format-version 2")
.cwd(p.root())
.with_status(1)
.with_stderr_contains(
"\
Expand Down
6 changes: 2 additions & 4 deletions tests/testsuite/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ fn package_git_submodule() {
None,
).unwrap();

cargo_process("package --no-verify -v")
.cwd(project.root())
project.cargo("package --no-verify -v")
.with_stderr_contains("[ARCHIVING] bar/Makefile")
.run();
}
Expand Down Expand Up @@ -625,8 +624,7 @@ fn repackage_on_source_change() {
std::mem::drop(file);

// Check that cargo rebuilds the tarball
cargo_process("package")
.cwd(p.root())
p.cargo("package")
.with_stderr(
"\
[WARNING] [..]
Expand Down
1 change: 0 additions & 1 deletion tests/testsuite/read_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ fn cargo_read_manifest_cwd() {
.build();

p.cargo("read-manifest")
.cwd(p.root())
.with_json(MANIFEST_OUTPUT)
.run();
}
1 change: 0 additions & 1 deletion tests/testsuite/verify_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ fn cargo_verify_project_cwd() {
.build();

p.cargo("verify-project")
.cwd(p.root())
.with_stdout(verify_project_success_output())
.run();
}
3 changes: 1 addition & 2 deletions tests/testsuite/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ fn explicit_package_argument_works_with_virtual_manifest() {
).file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
.file("bar/src/main.rs", "fn main() {}");
let p = p.build();
p.cargo("build --package bar").cwd(p.root()).run();
p.cargo("build --package bar").run();
assert!(p.root().join("Cargo.lock").is_file());
assert!(p.bin("bar").is_file());
assert!(!p.root().join("bar/Cargo.lock").is_file());
Expand Down Expand Up @@ -1222,7 +1222,6 @@ fn relative_path_for_root_works() {
let p = p.build();

p.cargo("build --manifest-path ./Cargo.toml")
.cwd(p.root())
.run();

p.cargo("build --manifest-path ../Cargo.toml")
Expand Down