File tree Expand file tree Collapse file tree 3 files changed +38
-5
lines changed Expand file tree Collapse file tree 3 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ pub(crate) fn pip_freeze(
8383 }
8484 } )
8585 . dedup ( )
86- . try_for_each ( |dist| writeln ! ( printer. stdout ( ) , "{dist}" ) ) ?;
86+ . try_for_each ( |dist| writeln ! ( printer. stdout_important ( ) , "{dist}" ) ) ?;
8787
8888 // Validate that the environment is consistent.
8989 if strict {
Original file line number Diff line number Diff line change 11use std:: cmp:: max;
22use std:: fmt:: Write ;
33
4- use anstream:: println;
54use anyhow:: Result ;
65use futures:: StreamExt ;
76use itertools:: Itertools ;
@@ -181,7 +180,7 @@ pub(crate) async fn pip_list(
181180 } )
182181 . collect_vec ( ) ;
183182 let output = serde_json:: to_string ( & rows) ?;
184- println ! ( "{output}" ) ;
183+ writeln ! ( printer . stdout_important ( ) , "{output}" ) ? ;
185184 }
186185 ListFormat :: Columns if results. is_empty ( ) => { }
187186 ListFormat :: Columns => {
@@ -255,13 +254,18 @@ pub(crate) async fn pip_list(
255254 }
256255
257256 for elems in MultiZip ( columns. iter ( ) . map ( Column :: fmt) . collect_vec ( ) ) {
258- println ! ( "{}" , elems. join( " " ) . trim_end( ) ) ;
257+ writeln ! ( printer . stdout_important ( ) , "{}" , elems. join( " " ) . trim_end( ) ) ? ;
259258 }
260259 }
261260 ListFormat :: Freeze if results. is_empty ( ) => { }
262261 ListFormat :: Freeze => {
263262 for dist in & results {
264- println ! ( "{}=={}" , dist. name( ) . bold( ) , dist. version( ) ) ;
263+ writeln ! (
264+ printer. stdout_important( ) ,
265+ "{}=={}" ,
266+ dist. name( ) . bold( ) ,
267+ dist. version( )
268+ ) ?;
265269 }
266270 }
267271 }
Original file line number Diff line number Diff line change @@ -453,3 +453,32 @@ fn freeze_nonexistent_path() {
453453 ----- stderr -----
454454 " ) ;
455455}
456+
457+ #[ test]
458+ fn freeze_with_quiet_flag ( ) -> Result < ( ) > {
459+ let context = TestContext :: new ( "3.12" ) ;
460+
461+ let requirements_txt = context. temp_dir . child ( "requirements.txt" ) ;
462+ requirements_txt. write_str ( "MarkupSafe==2.1.3\n tomli==2.0.1" ) ?;
463+
464+ // Run `pip sync`.
465+ context
466+ . pip_sync ( )
467+ . arg ( requirements_txt. path ( ) )
468+ . assert ( )
469+ . success ( ) ;
470+
471+ // Run `pip freeze` with `--quiet` flag.
472+ uv_snapshot ! ( context. pip_freeze( ) . arg( "--quiet" ) , @r###"
473+ success: true
474+ exit_code: 0
475+ ----- stdout -----
476+ markupsafe==2.1.3
477+ tomli==2.0.1
478+
479+ ----- stderr -----
480+ "###
481+ ) ;
482+
483+ Ok ( ( ) )
484+ }
You can’t perform that action at this time.
0 commit comments