diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index ddb80d4e2e9..ec0f4cdce29 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -113,6 +113,7 @@ def _load_tokens_from_file(file_path): raise CLIError("Failed to load token files. If you have a repro, please log an issue at " "https://github.com/Azure/azure-cli/issues. At the same time, you can clean " "up by running 'az account clear' and then 'az login'. (Inner Error: {})".format(ex)) + logger.debug("'%s' is not a file or doesn't exist.", file_path) return [] diff --git a/src/azure-cli-core/azure/cli/core/tests/test_profile.py b/src/azure-cli-core/azure/cli/core/tests/test_profile.py index 71605d36321..71705e20fe5 100644 --- a/src/azure-cli-core/azure/cli/core/tests/test_profile.py +++ b/src/azure-cli-core/azure/cli/core/tests/test_profile.py @@ -1787,8 +1787,9 @@ def get_auth_context(_, authority, **kwargs): # pylint: disable=unused-argument self.assertEqual(token_type, token_entry2['tokenType']) @mock.patch('azure.cli.core._profile.get_file_json', autospec=True) - def test_credscache_good_error_on_file_corruption(self, mock_read_file): - mock_read_file.side_effect = ValueError('a bad error for you') + @mock.patch('os.path.isfile', autospec=True, return_value=True) + def test_credscache_good_error_on_file_corruption(self, isfile_mock, get_file_json_mock): + get_file_json_mock.side_effect = ValueError('a bad error for you') cli = DummyCli() # action