@@ -105,11 +105,14 @@ def dummy_count_free_space(entry_self: EntryPoint) -> float: # noqa
105105 assert f"Removed - { size_multiplier / 2 } GB" in captured_stdout
106106
107107 @pytest .mark .parametrize ("cleanup_prompted" , [True , False ])
108- def test_dry_run_prompt (self , cleanup_prompted : bool , capsys : CaptureFixture [str ], monkeypatch : MonkeyPatch ):
109- """Test dry_run with optional cleanup in :class:`mac_cleanup.main.EntryPoint`"""
108+ @pytest .mark .parametrize ("verbose" , [True , False ])
109+ def test_dry_run_prompt (
110+ self , cleanup_prompted : bool , verbose : bool , capsys : CaptureFixture [str ], monkeypatch : MonkeyPatch
111+ ):
112+ """Test dry_run with verbose and optional cleanup in :class:`mac_cleanup.main.EntryPoint`"""
110113
111- # Dummy count_dry returning 1 GB
112- dummy_count_dry : Callable [..., float ] = lambda : float (1024 ** 3 )
114+ # Dummy _extract_paths returning [Pathlib("test") and 1 GB]
115+ dummy_extract_paths : Callable [..., list [ tuple [ Pathlib , float ]]] = lambda : [( Pathlib ( "test" ), float (1024 ** 3 ))]
113116
114117 # Dummy Config with empty init
115118 def dummy_config_init (cfg_self : Config , config_path_ : Pathlib ) -> None : # noqa # noqa
@@ -136,15 +139,18 @@ def dummy_config_call(config_path_: Pathlib, configuration_prompted: bool) -> No
136139 mock_entry_point = EntryPoint ()
137140 monkeypatch .setattr (EntryPoint , "__new__" , lambda : mock_entry_point )
138141
139- # Simulate count_dry with predefined result
140- monkeypatch .setattr (mock_entry_point .base_collector , "_count_dry " , dummy_count_dry )
142+ # Simulate _extract_paths with predefined result
143+ monkeypatch .setattr (mock_entry_point .base_collector , "_extract_paths " , dummy_extract_paths )
141144
142145 # Simulate empty cleanup
143146 monkeypatch .setattr (EntryPoint , "cleanup" , dummy_cleanup )
144147
145148 # Simulate dry run was prompted
146149 monkeypatch .setattr ("mac_cleanup.parser.Args.dry_run" , True )
147150
151+ # Simulate verbose was set
152+ monkeypatch .setattr ("mac_cleanup.parser.Args.verbose" , verbose )
153+
148154 # Call entrypoint
149155 main ()
150156
@@ -155,15 +161,23 @@ def dummy_config_call(config_path_: Pathlib, configuration_prompted: bool) -> No
155161 assert "Dry run results" in captured_stdout
156162 assert "Approx 1.0 GB will be cleaned" in captured_stdout
157163
164+ # Check verbose message
165+ if verbose :
166+ assert "1.0 GB test" in captured_stdout
167+
168+ # Check no verbose message
169+ if not verbose :
170+ assert "1.0 GB test" not in captured_stdout
171+
158172 # Check exit message
159173 if not cleanup_prompted :
160174 assert "Exiting..." in captured_stdout
161175
162176 def test_dry_run_prompt_error (self , capsys : CaptureFixture [str ], monkeypatch : MonkeyPatch ):
163177 """Test errors in dry_run in :class:`mac_cleanup.main.EntryPoint`"""
164178
165- # Dummy count_dry returning 1 GB
166- dummy_count_dry : Callable [..., float ] = lambda : float (1024 ** 3 )
179+ # Dummy _extract_paths returning [Pathlib("test") and 1 GB]
180+ dummy_extract_paths : Callable [..., list [ tuple [ Pathlib , float ]]] = lambda : [( Pathlib ( "test" ), float (1024 ** 3 ))]
167181
168182 # Dummy Config with no init and empty call
169183 # Dummy Config with empty init
@@ -189,8 +203,8 @@ def dummy_input(*args: Any, **kwargs: Any) -> None: # noqa
189203 mock_entry_point = EntryPoint ()
190204 monkeypatch .setattr (EntryPoint , "__new__" , lambda : mock_entry_point )
191205
192- # Simulate count_dry with predefined result
193- monkeypatch .setattr (mock_entry_point .base_collector , "_count_dry " , dummy_count_dry )
206+ # Simulate _extract_paths with predefined result
207+ monkeypatch .setattr (mock_entry_point .base_collector , "_extract_paths " , dummy_extract_paths )
194208
195209 # Simulate dry run was prompted
196210 monkeypatch .setattr ("mac_cleanup.parser.Args.dry_run" , True )
0 commit comments