potiuk commented on code in PR #26848:
URL: https://github.com/apache/airflow/pull/26848#discussion_r990948490


##########
tests/providers/cncf/kubernetes/utils/test_pod_manager.py:
##########
@@ -331,6 +332,23 @@ def test_fetch_container_running_follow(
         assert ret.last_log_time == DateTime(2021, 1, 1, 
tzinfo=Timezone('UTC'))
         assert ret.running is exp_running
 
+    def test_pod_manager_get_client_call_deprecation(self):
+        """Ensure that kube_client.get_kube_client is removed from pod manager 
in provider 6.0."""
+        try:
+            from airflow.providers.cncf.kubernetes.utils.pod_manager import 
get_kube_client  # noqa
+        except ImportError:
+            raise Exception(
+                "You must remove this test. It only exists to remind us to 
remove `get_kube_client`."
+            )
+        from airflow.providers_manager import ProvidersManager
+
+        info = 
ProvidersManager().providers['apache-airflow-providers-cncf-kubernetes']
+        if semver.VersionInfo.parse(info.version) >= (6, 0):

Review Comment:
   I was thinking about extracting the "from .. import" as lambda in the form 
of:
   
   ```
   lambda: 
__import__('airflow.providers.cncf.kubernetes.utils.pod_manager.get_kube_client')
   ```
   
   Passed by parameterized. Then there could be one test covering multiple 
similar cases rather than having to copy  the try/except/raise provider in 
multiple tests.
   



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