You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2026/06/15 10:29:47 UTC

Re: [PR] Fix TypeError in PercentFormatRender when numeric callsite parameters… [airflow]

uranusjr commented on code in PR #66230:
URL: https://github.com/apache/airflow/pull/66230#discussion_r3412757813


##########
shared/logging/tests/logging/test_percent_formatter.py:
##########
@@ -40,3 +40,40 @@ def test_lineno_is_none(self):
         )
 
         assert formatted == "test.py:0 our msg"
+
+    @mock.patch("airflow_shared.logging.percent_formatter.os.getpid")
+    @mock.patch("airflow_shared.logging.percent_formatter.threading.get_ident")
+    def test_process_thread_missing_returns_live_values(self, mock_get_ident, mock_getpid):
+        mock_getpid.return_value = 123
+        mock_get_ident.return_value = 456
+        fmt = "%(process)d %(thread)d %(lineno)d %(message)s"
+        renderer = PercentFormatRender(fmt)
+
+        event_dict = {"event": "test message"}
+        result = renderer(None, "info", event_dict)
+        assert result.startswith("123 456 0 test message")
+
+    @mock.patch("airflow_shared.logging.percent_formatter.os.getpid")
+    @mock.patch("airflow_shared.logging.percent_formatter.threading.get_ident")
+    def test_process_thread_unknown_string_returns_live_values(self, mock_get_ident, mock_getpid):

Review Comment:
   ```suggestion
       def test_unknown_string_returns_live_values(self, mock_get_ident, mock_getpid):
   ```



-- 
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