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

READY : change table format #1224

Merged
merged 1 commit into from
Mar 20, 2024
Merged
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
29 changes: 24 additions & 5 deletions module/move/willbe/src/entity/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mod private
// qqq : for Petro : don't do micro imports
#[ cfg( feature = "progress_bar" ) ]
use indicatif::{ MultiProgress, ProgressBar, ProgressStyle };
use prettytable::format::{ FormatBuilder, TableFormat };
use rayon::ThreadPoolBuilder;
use process_tools::process::*;
use wtools::error::anyhow::{ Error, format_err };
Expand Down Expand Up @@ -146,14 +147,15 @@ mod private
{
writeln!( f, "Package : {}\nThe tests will be executed using the following configurations :", self.package.file_name().unwrap().to_string_lossy() )?;
let mut table = Table::new();
table.set_format( *prettytable::format::consts::FORMAT_NO_BORDER );
let format = format();
table.set_format( format );
let mut all_features = BTreeSet::new();
for variant in &self.test_variants
{
let features = variant.features.iter().cloned();
if features.len() == 0
{
all_features.extend( [ "[ ]".to_string() ] );
all_features.extend( [ "[]".to_string() ] );
}
all_features.extend( features );
}
Expand All @@ -164,7 +166,7 @@ mod private
{
header_row.add_cell( Cell::new( feature ) );
}
table.add_row( header_row );
table.set_titles( header_row );

for variant in &self.test_variants
{
Expand Down Expand Up @@ -268,6 +270,21 @@ mod private
}
}

fn format() -> TableFormat
{
let format = FormatBuilder::new()
.column_separator( ' ' )
.borders( ' ' )
.separators
(
&[ prettytable::format::LinePosition::Title ],
prettytable::format::LineSeparator::new( '-', '+', '+', '+' )
)
.padding( 1, 1 )
.build();
format
}

#[ derive( Debug, Former ) ]
pub struct PackageTestOptions< 'a >
{
Expand Down Expand Up @@ -490,14 +507,16 @@ mod private
return Ok( () )
}
let mut table = Table::new();
let format = format();
table.set_format( format );
table.set_format( *prettytable::format::consts::FORMAT_NO_BORDER );
let mut all_features = BTreeSet::new();
for variant in self.tests.keys()
{
let features = variant.features.iter().cloned();
if features.len() == 0
{
all_features.extend( [ "[ ]".to_string() ] );
all_features.extend( [ "[]".to_string() ] );
}
all_features.extend( features );
}
Expand All @@ -509,7 +528,7 @@ mod private
{
header_row.add_cell( Cell::new( feature ) );
}
table.add_row( header_row );
table.set_titles( header_row );

let mut failed = 0;
let mut success = 0;
Expand Down