Skip to content

Commit d0983fb

Browse files
committed
Don't print to raw stderr in test
Avoids polluting the output of tests with Cargo's build output.
1 parent 974eb43 commit d0983fb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/testsuite/build.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
//! Tests for the `cargo build` command.
22
33
use cargo::{
4-
core::compiler::CompileMode, core::Workspace, ops::CompileOptions,
5-
util::paths::dylib_path_envvar, Config,
4+
core::compiler::CompileMode,
5+
core::{Shell, Workspace},
6+
ops::CompileOptions,
7+
util::paths::dylib_path_envvar,
8+
Config,
69
};
710
use cargo_test_support::paths::{root, CargoPathExt};
811
use cargo_test_support::registry::Package;
912
use cargo_test_support::{
1013
basic_bin_manifest, basic_lib_manifest, basic_manifest, is_nightly, lines_match, main_file,
11-
project, rustc_host, sleep_ms, symlink_supported, t, Execs, ProjectBuilder,
14+
paths, project, rustc_host, sleep_ms, symlink_supported, t, Execs, ProjectBuilder,
1215
};
1316
use std::env;
1417
use std::fs;
@@ -427,7 +430,8 @@ fn cargo_compile_api_exposes_artifact_paths() {
427430
.file("src/bin.rs", "pub fn main() {}")
428431
.build();
429432

430-
let config = Config::default().unwrap();
433+
let shell = Shell::from_write(Box::new(Vec::new()));
434+
let config = Config::new(shell, env::current_dir().unwrap(), paths::home());
431435
let ws = Workspace::new(&p.root().join("Cargo.toml"), &config).unwrap();
432436
let compile_options = CompileOptions::new(ws.config(), CompileMode::Build).unwrap();
433437

0 commit comments

Comments
 (0)