10
10
11
11
import logging
12
12
from pathlib import Path
13
- from unittest .mock import MagicMock , patch , mock_open , call
13
+ from unittest .mock import MagicMock , patch , mock_open
14
14
import pytest
15
15
from click .testing import CliRunner
16
16
@@ -105,7 +105,7 @@ def test_generate_project_flag(self, cli_runner):
105
105
# Test main function with config file
106
106
def test_main_with_config_file (self , cli_runner , mock_dependencies ):
107
107
"""Test main function with explicitly provided config file."""
108
- mock_matlab_agent , mock_setup_logger , mock_load_config , mock_logger = mock_dependencies
108
+ mock_matlab_agent , _ , mock_load_config , _ = mock_dependencies
109
109
110
110
mock_load_config .return_value = {
111
111
'agent' : {'agent_id' : 'custom_agent' },
@@ -129,7 +129,7 @@ def test_main_with_config_file(self, cli_runner, mock_dependencies):
129
129
def test_main_without_config_file_exists (
130
130
self , cli_runner , mock_dependencies , default_config ):
131
131
"""Test main function when config.yaml exists in current directory."""
132
- mock_matlab_agent , mock_setup_logger , mock_load_config , mock_logger = mock_dependencies
132
+ mock_matlab_agent , _ , mock_load_config , _ = mock_dependencies
133
133
134
134
with patch ('pathlib.Path.exists' , return_value = True ):
135
135
mock_load_config .return_value = default_config
@@ -261,7 +261,7 @@ def test_generate_default_config_success_importlib(self):
261
261
with patch ('pathlib.Path.cwd' , return_value = test_dir ), \
262
262
patch ('pathlib.Path.exists' , return_value = False ), \
263
263
patch ('importlib.resources.files' ) as mock_files , \
264
- patch ('builtins.open' , mock_open ()) as mock_file :
264
+ patch ('builtins.open' , mock_open ()) as _ :
265
265
266
266
# Mock importlib.resources.files behavior
267
267
mock_resource = MagicMock ()
@@ -297,7 +297,7 @@ def test_generate_default_config_fallback_pkg_resources(self):
297
297
patch ('pathlib.Path.exists' , return_value = False ), \
298
298
patch ('importlib.resources.files' , side_effect = ImportError ()), \
299
299
patch .dict ('sys.modules' , {'pkg_resources' : mock_pkg_resources }), \
300
- patch ('builtins.open' , mock_open ()) as mock_file , \
300
+ patch ('builtins.open' , mock_open ()) as _ , \
301
301
patch ('builtins.print' ) as mock_print :
302
302
303
303
generate_default_config ()
@@ -368,7 +368,7 @@ def test_generate_config_with_attribute_error_fallback(self):
368
368
patch ('pathlib.Path.exists' , return_value = False ), \
369
369
patch ('importlib.resources.files' , side_effect = AttributeError ()), \
370
370
patch .dict ('sys.modules' , {'pkg_resources' : mock_pkg_resources }), \
371
- patch ('builtins.open' , mock_open ()) as mock_file , \
371
+ patch ('builtins.open' , mock_open ()) as _ , \
372
372
patch ('builtins.print' ) as mock_print :
373
373
374
374
generate_default_config ()
@@ -381,7 +381,7 @@ def test_generate_default_project_success_importlib(self):
381
381
"""Test successful project generation using importlib.resources."""
382
382
with patch ('pathlib.Path.exists' , return_value = False ), \
383
383
patch ('importlib.resources.files' ) as mock_files , \
384
- patch ('builtins.open' , mock_open ()) as mock_file , \
384
+ patch ('builtins.open' , mock_open ()) as _ , \
385
385
patch ('builtins.print' ) as mock_print :
386
386
387
387
# Mock importlib.resources.files behavior
@@ -506,7 +506,7 @@ def test_cli_help_option(self, cli_runner):
506
506
507
507
def test_cli_short_config_option (self , cli_runner , mock_dependencies ):
508
508
"""Test short form of config option (-c)."""
509
- mock_matlab_agent , mock_setup_logger , mock_load_config , mock_logger = mock_dependencies
509
+ _ , _ , mock_load_config , _ = mock_dependencies
510
510
511
511
mock_load_config .return_value = {
512
512
'agent' : {'agent_id' : 'test_agent' },
@@ -534,7 +534,7 @@ def test_multiple_flags_priority(self, cli_runner):
534
534
535
535
def test_broker_type_hardcoded (self , cli_runner , mock_dependencies ):
536
536
"""Test that broker_type is hardcoded to 'rabbitmq'."""
537
- mock_matlab_agent , mock_setup_logger , mock_load_config , mock_logger = mock_dependencies
537
+ mock_matlab_agent , _ , mock_load_config , _ = mock_dependencies
538
538
539
539
mock_load_config .return_value = {
540
540
'agent' : {'agent_id' : 'test_agent' },
0 commit comments