File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3535- Fixed table style taking precedence over row style https://github.com/willmcgugan/rich/issues/1129
3636- Fixed incorrect measurement of Text with new lines and whitespace https://github.com/willmcgugan/rich/issues/1133
3737- Made type annotations consistent for various ` total ` keyword arguments in ` rich.progress ` and rich.` progress_bar `
38-
38+ - Disabled Progress no longer displays itself when starting https://github.com/willmcgugan/rich/pull/1125
3939
4040## [ 9.13.0] - 2021-03-06
4141
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ The following people have contributed to the development of Rich:
66
77- [ Oleksis Fraga] ( https://github.com/oleksis )
88- [ Finn Hughes] ( https://github.com/finnhughes )
9+ - [ Josh Karpel] ( https://github.com/JoshKarpel )
910- [ Hedy Li] ( https://github.com/hedythedev )
1011- [ Alexander Mancevice] ( https://github.com/amancevice )
1112- [ Will McGugan] ( https://github.com/willmcgugan )
Original file line number Diff line number Diff line change @@ -634,7 +634,8 @@ def finished(self) -> bool:
634634
635635 def start (self ) -> None :
636636 """Start the progress display."""
637- self .live .start (refresh = True )
637+ if not self .disable :
638+ self .live .start (refresh = True )
638639
639640 def stop (self ) -> None :
640641 """Stop the progress display."""
Original file line number Diff line number Diff line change @@ -434,6 +434,44 @@ def get_time() -> float:
434434 )
435435
436436
437+ def test_live_is_started_if_progress_is_enabled () -> None :
438+ progress = Progress (auto_refresh = False , disable = False )
439+
440+ with progress :
441+ assert progress .live ._started
442+
443+
444+ def test_live_is_not_started_if_progress_is_disabled () -> None :
445+ progress = Progress (auto_refresh = False , disable = True )
446+
447+ with progress :
448+ assert not progress .live ._started
449+
450+
451+ def test_no_output_if_progress_is_disabled () -> None :
452+ console = Console (
453+ file = io .StringIO (),
454+ force_terminal = True ,
455+ width = 60 ,
456+ color_system = "truecolor" ,
457+ legacy_windows = False ,
458+ _environ = {},
459+ )
460+ progress = Progress (
461+ console = console ,
462+ disable = True ,
463+ )
464+ test = ["foo" , "bar" , "baz" ]
465+ expected_values = iter (test )
466+ with progress :
467+ for value in progress .track (test , description = "test" ):
468+ assert value == next (expected_values )
469+ result = console .file .getvalue ()
470+ print (repr (result ))
471+ expected = ""
472+ assert result == expected
473+
474+
437475if __name__ == "__main__" :
438476 _render = render_progress ()
439477 print (_render )
You can’t perform that action at this time.
0 commit comments