kaxil commented on code in PR #39450:
URL: https://github.com/apache/airflow/pull/39450#discussion_r1593291680


##########
tests/providers/cncf/kubernetes/test_pod_generator.py:
##########
@@ -170,7 +170,7 @@ def test_gen_pod_extract_xcom(self, mock_rand_str, 
data_file):
         template_file = 
data_file("pods/generator_base_with_secrets.yaml").as_posix()
 
         pod_generator = PodGenerator(pod_template_file=template_file, 
extract_xcom=True)
-        with pytest.warns(AirflowProviderDeprecationWarning, match="deprecated 
and will be removed"):
+        with pytest.warns(AirflowProviderDeprecationWarning):

Review Comment:
   We don't need to match the error. 
   
   If we do, it fails because the last warning is raised from  
`self.add_xcom_sidecar(result)` which is also deprecated.
   
   
https://github.com/apache/airflow/blob/f5c86edb7967102d26435018e367354735044f56/airflow/providers/cncf/kubernetes/pod_generator.py#L169
   
   
https://github.com/apache/airflow/blob/f5c86edb7967102d26435018e367354735044f56/airflow/providers/cncf/kubernetes/pod_generator.py#L173-L181
   
   
   I could filter it using the following but that deprecation match isn't 
needed anymore:
   
   
   ```python
       with warnings.catch_warnings():
           warnings.simplefilter("ignore", AirflowProviderDeprecationWarning)  
# Ignore all deprecation warnings
           warnings.filterwarnings("always", "This method is deprecated and 
will be removed in the future releases", AirflowProviderDeprecationWarning)  # 
Except for this specific one
           with pytest.raises(AirflowProviderDeprecationWarning, match="This 
method is deprecated and will be removed in the future releases"):
               result = pod_generator.gen_pod()
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to