Skip to content

Commit 15f9c2d

Browse files
committed
Fix formats_source test requiring rustfmt.
1 parent 3ccf7dc commit 15f9c2d

File tree

1 file changed

+10
-2
lines changed
  • tests/testsuite/init/formats_source

1 file changed

+10
-2
lines changed

tests/testsuite/init/formats_source/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
use cargo_test_support::compare::assert_ui;
22
use cargo_test_support::prelude::*;
3-
use cargo_test_support::Project;
3+
use cargo_test_support::{process, Project};
44

55
use cargo_test_support::curr_dir;
66

7-
#[cargo_test(requires_rustfmt)]
7+
#[cargo_test]
88
fn formats_source() {
9+
// This cannot use `requires_rustfmt` because rustfmt is not available in
10+
// the rust-lang/rust environment. Additionally, if running cargo without
11+
// rustup (but with rustup installed), this test also fails due to HOME
12+
// preventing the proxy from choosing a toolchain.
13+
if let Err(e) = process("rustfmt").arg("-V").exec_with_output() {
14+
eprintln!("skipping test, rustfmt not available:\n{e:?}");
15+
return;
16+
}
917
let project = Project::from_template(curr_dir!().join("in"));
1018
let project_root = &project.root();
1119

0 commit comments

Comments
 (0)