Skip to content

Commit

Permalink
feat: disable progress bars in the tests (#1995)
Browse files Browse the repository at this point in the history
Disables the progress bars for the tests. Because it was overwritting
the output a lot, especially when using `cargo t`.
  • Loading branch information
tdejager authored Sep 6, 2024
1 parent ae029fd commit b1d4ba2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::common::builders::{
AddBuilder, InitBuilder, InstallBuilder, ProjectChannelAddBuilder,
ProjectEnvironmentAddBuilder, TaskAddBuilder, TaskAliasBuilder, UpdateBuilder,
};
use indicatif::ProgressDrawTarget;
use miette::{Context, Diagnostic, IntoDiagnostic};
use pixi::cli::cli_config::{PrefixUpdateConfig, ProjectConfig};
use pixi::task::{
Expand All @@ -34,6 +35,7 @@ use pixi::{
};
use pixi_consts::consts;
use pixi_manifest::{EnvironmentName, FeatureName};
use pixi_progress::global_multi_progress;
use rattler_conda_types::{MatchSpec, ParseStrictness::Lenient, Platform};
use rattler_lock::{LockFile, Package};
use tempfile::TempDir;
Expand All @@ -49,6 +51,11 @@ pub struct RunResult {
output: Output,
}

/// Hides the progress bars for the tests
fn hide_progress_bars() {
global_multi_progress().set_draw_target(ProgressDrawTarget::hidden());
}

impl RunResult {
/// Was the output successful
pub fn success(&self) -> bool {
Expand Down Expand Up @@ -156,6 +163,9 @@ impl PixiControl {
/// Create a new PixiControl instance
pub fn new() -> miette::Result<PixiControl> {
let tempdir = tempfile::tempdir().into_diagnostic()?;
// Hide the progress bars for the tests
// Otherwise the override the test output
hide_progress_bars();
Ok(PixiControl { tmpdir: tempdir })
}

Expand Down

0 comments on commit b1d4ba2

Please sign in to comment.