@@ -167,21 +167,19 @@ def test_remove_stats():
167167
168168
169169@pytest .mark .parametrize (
170- "total_flows, current_n" ,
170+ "total_flows, current_n, keyboard_int " ,
171171 [
172172 # testcase1: Normal case
173- (100 , 100 ),
173+ (100 , 100 , 0 ),
174174 # testcase2: Edge case - zero flows
175- (0 , 0 ),
175+ (0 , 0 , 1 ),
176176 # testcase3: Large number of flows
177- (1000000 , 1000000 ),
177+ (1000000 , 1000000 , 0 ),
178178 ],
179179)
180- def test_shutdown_gracefully (
181- total_flows ,
182- current_n ,
183- ):
180+ def test_shutdown_gracefully (total_flows , current_n , keyboard_int ):
184181 pbar = ModuleFactory ().create_progress_bar_obj ()
182+ pbar .keyboard_int_ctr = keyboard_int
185183 pbar .total_flows = total_flows
186184 pbar .pbar_finished = Event ()
187185
@@ -193,10 +191,13 @@ def test_shutdown_gracefully(
193191 "tqdm.auto.tqdm.write"
194192 ) as mock_write :
195193 pbar .shutdown_gracefully ()
196-
197194 mock_remove_stats .assert_called_once ()
198- mock_write .assert_called_once_with (
199- "Profiler is done reading all flows. "
200- "Slips is now processing them."
201- )
195+
196+ if not keyboard_int :
197+ mock_write .assert_not_called ()
198+ else :
199+ mock_write .assert_called_once_with (
200+ "Profiler is done reading all flows. "
201+ "Slips is now processing them."
202+ )
202203 assert pbar .pbar_finished .is_set ()
0 commit comments