Skip to content

Commit

Permalink
Move import at the top of the file (#12431)
Browse files Browse the repository at this point in the history
`from airflow.utils.state import State` is used in multiple functions.

I suggested it in apache/airflow#12384 but was missed

GitOrigin-RevId: ea865e4955e94326bbe9a12d2da653bd0f2c0993
  • Loading branch information
kaxil authored and Cloud Composer Team committed Sep 17, 2021
1 parent c594429 commit a6ea163
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions kubernetes_tests/test_kubernetes_pod_operator_backcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from airflow.models import DAG, TaskInstance
from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import KubernetesPodOperator
from airflow.utils import timezone
from airflow.utils.state import State
from airflow.version import version as airflow_version


Expand Down Expand Up @@ -129,8 +130,6 @@ def create_context(self, task):
@mock.patch("airflow.kubernetes.pod_launcher.PodLauncher.monitor_pod")
@mock.patch("airflow.kubernetes.kube_client.get_kube_client")
def test_image_pull_secrets_correctly_set(self, mock_client, monitor_mock, start_mock):
from airflow.utils.state import State

fake_pull_secrets = "fakeSecret"
k = KubernetesPodOperator(
namespace='default',
Expand Down Expand Up @@ -489,8 +488,6 @@ def test_xcom_push(self):
@mock.patch("airflow.kubernetes.kube_client.get_kube_client")
def test_envs_from_configmaps(self, mock_client, mock_monitor, mock_start):
# GIVEN
from airflow.utils.state import State

configmap = 'test-configmap'
# WHEN
k = KubernetesPodOperator(
Expand Down Expand Up @@ -519,8 +516,6 @@ def test_envs_from_configmaps(self, mock_client, mock_monitor, mock_start):
@mock.patch("airflow.kubernetes.kube_client.get_kube_client")
def test_envs_from_secrets(self, mock_client, monitor_mock, start_mock):
# GIVEN
from airflow.utils.state import State

secret_ref = 'secret_name'
secrets = [Secret('env', None, secret_ref)]
# WHEN
Expand Down Expand Up @@ -655,8 +650,6 @@ def test_pod_priority_class_name(
self, mock_client, monitor_mock, start_mock
): # pylint: disable=unused-argument
"""Test ability to assign priorityClassName to pod"""
from airflow.utils.state import State

priority_class_name = "medium-test"
k = KubernetesPodOperator(
namespace='default',
Expand Down

0 comments on commit a6ea163

Please sign in to comment.