@@ -144,7 +144,7 @@ def test_cache_disabled_with_no_cache_flag(self, tmp_path, capsys):
144144 _out1 , _ = capsys .readouterr ()
145145
146146 # Act - run with --no-cache flag
147- second_result = check_files (no_cache = True , return_result = True , verbose = True )
147+ second_result = check_files (cache = False , return_result = True , verbose = True )
148148 out2 , _ = capsys .readouterr ()
149149
150150 # Assert - should rescan even though file unchanged
@@ -351,8 +351,29 @@ def test_empty_file_integration(self, tmp_path, capsys):
351351 # Assert - should rescan (cache invalidated due to size change)
352352 assert "Scanning file:" in out2
353353
354+ def test_default_cli_does_not_override_config_file_disabled (self , tmp_path , capsys ):
355+ """Test CLI without any option set does not override the config file with cache=false."""
356+ # Arrange - create config file with cache disabled
357+ config_file = tmp_path / "pyproject.toml"
358+ config_file .write_text ("[tool.robocop]\n cache = false\n " , encoding = "utf-8" )
359+ test_file = tmp_path / "test.robot"
360+ test_file .write_text ("*** Test Cases ***\n Test\n Log Hello\n " , encoding = "utf-8" )
361+
362+ with working_directory (tmp_path ):
363+ # Act - run with default CLI (cache disabled from config)
364+ check_files (verbose = True , return_result = True )
365+ out , _ = capsys .readouterr ()
366+
367+ # Assert - should NOT use cache (rescans file)
368+ assert "Scanning file:" in out
369+ assert "Used cached results" not in out
370+
371+ # Assert - cache file should not be created
372+ cache_dir = tmp_path / ".robocop_cache"
373+ assert not cache_dir .exists ()
374+
354375 def test_cli_cache_dir_overrides_config_file_disabled (self , tmp_path ):
355- """Test CLI --cache-dir enables cache and overrides config file with cache=false."""
376+ """Test CLI --cache-dir enables cache and overrides the config file with cache=false."""
356377 # Arrange - create config file with cache disabled
357378 config_file = tmp_path / "pyproject.toml"
358379 config_file .write_text ("[tool.robocop]\n cache = false\n " , encoding = "utf-8" )
@@ -396,9 +417,8 @@ def test_cli_no_cache_flag_overrides_config_file_enabled(self, tmp_path, capsys)
396417 # Verify cache was created
397418 assert is_file_in_cache (tmp_path , test_file )
398419
399- # Act - run with no_cache=True via CLI (simulating --no-cache flag)
400- # This overrides the config file's cache=true
401- check_files (no_cache = True , return_result = True , verbose = True )
420+ # Act - Override config file's cache=true with --no-cache flag
421+ check_files (cache = False , return_result = True , verbose = True )
402422 out2 , _ = capsys .readouterr ()
403423
404424 # Assert - should NOT use cache (rescans file)
0 commit comments