You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/10/10 17:23:56 UTC

[GitHub] [airflow] Taragolis commented on a diff in pull request #26973: Filter logs for specific logger in `TestGetGcpCredentialsAndProjectId.test_disable_logging`

Taragolis commented on code in PR #26973:
URL: https://github.com/apache/airflow/pull/26973#discussion_r991508315


##########
tests/providers/google/cloud/utils/test_credentials_provider.py:
##########
@@ -327,11 +327,28 @@ def test_get_credentials_and_project_id_with_mutually_exclusive_configuration(
         'google.oauth2.service_account.Credentials.from_service_account_file',
     )
     def test_disable_logging(self, mock_default, mock_info, mock_file):
-        # assert not logs
+        """
+        Test disable logging in ``get_credentials_and_project_id``.
+
+        Due to selected limitation:
+        - Unable mixin pytest autouse-fixture `caplog` with `unittest.TestCase`
+        - `unittest.TestCase.assertNoLogs` available only in Python 3.10+
+
+        We use some workarounds for filtering specific logger and raise error with these records.
+        """
+        logger_name = "airflow.providers.google.cloud.utils.credentials_provider._CredentialProvider"
+

Review Comment:
   Good idea. Initially I keep it outside for use it with pure `pytest`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org