1+ import io
12import json
23import logging
34from pathlib import Path
4- from unittest .mock import Mock , patch
5+ from unittest .mock import patch
56
67import pytest
78
@@ -235,7 +236,7 @@ def test_inspect_happy_path_prints_sections(tmp_path: Path) -> None:
235236"""
236237 )
237238
238- with patch ("sys.stdout" , new = Mock ()), patch ("builtins.print" ) as mprint :
239+ with patch ("sys.stdout" , new = io . StringIO ()), patch ("builtins.print" ) as mprint :
239240 cli .main (["inspect" , str (scenario_file )])
240241
241242 out_lines = [c .args [0 ] for c in mprint .call_args_list ]
@@ -266,7 +267,7 @@ def test_inspect_detail_mode_includes_tables(tmp_path: Path) -> None:
266267"""
267268 )
268269
269- with patch ("sys.stdout" , new = Mock ()), patch ("builtins.print" ) as mprint :
270+ with patch ("sys.stdout" , new = io . StringIO ()), patch ("builtins.print" ) as mprint :
270271 cli .main (["inspect" , str (scenario_file ), "--detail" ])
271272
272273 out = "\n " .join (str (c .args [0 ]) for c in mprint .call_args_list )
@@ -293,7 +294,7 @@ def test_inspect_detail_mode_cost_shows_decimals(tmp_path: Path) -> None:
293294"""
294295 )
295296
296- with patch ("sys.stdout" , new = Mock ()), patch ("builtins.print" ) as mprint :
297+ with patch ("sys.stdout" , new = io . StringIO ()), patch ("builtins.print" ) as mprint :
297298 cli .main (["inspect" , str (scenario_file ), "--detail" ])
298299
299300 out = "\n " .join (str (c .args [0 ]) for c in mprint .call_args_list )
@@ -319,7 +320,7 @@ def test_inspect_workflow_node_selection_preview_basic(tmp_path: Path) -> None:
319320"""
320321 )
321322
322- with patch ("sys.stdout" , new = Mock ()), patch ("builtins.print" ) as mprint :
323+ with patch ("sys.stdout" , new = io . StringIO ()), patch ("builtins.print" ) as mprint :
323324 cli .main (["inspect" , str (scenario_file )])
324325
325326 out = "\n " .join (str (c .args [0 ]) for c in mprint .call_args_list )
@@ -344,7 +345,7 @@ def test_inspect_workflow_node_selection_detail_and_warning(tmp_path: Path) -> N
344345"""
345346 )
346347
347- with patch ("sys.stdout" , new = Mock ()), patch ("builtins.print" ) as mprint :
348+ with patch ("sys.stdout" , new = io . StringIO ()), patch ("builtins.print" ) as mprint :
348349 cli .main (["inspect" , str (scenario_file ), "--detail" ])
349350
350351 out = "\n " .join (str (c .args [0 ]) for c in mprint .call_args_list )
@@ -376,7 +377,7 @@ def test_inspect_capacity_vs_demand_summary_basic(tmp_path: Path) -> None:
376377"""
377378 )
378379
379- with patch ("sys.stdout" , new = Mock ()), patch ("builtins.print" ) as mprint :
380+ with patch ("sys.stdout" , new = io . StringIO ()), patch ("builtins.print" ) as mprint :
380381 cli .main (["inspect" , str (scenario_file )])
381382
382383 out = "\n " .join (str (c .args [0 ]) for c in mprint .call_args_list )
0 commit comments