diff --git a/tests/models/test_taskinstance.py b/tests/models/test_taskinstance.py index 71c6c2f8c4ec5..da3d138306235 100644 --- a/tests/models/test_taskinstance.py +++ b/tests/models/test_taskinstance.py @@ -57,7 +57,7 @@ ) from airflow.models.serialized_dag import SerializedDagModel from airflow.models.taskfail import TaskFail -from airflow.models.taskinstance import TaskInstance, _executor_config_comparator +from airflow.models.taskinstance import TaskInstance from airflow.models.taskmap import TaskMap from airflow.models.xcom import XCOM_RETURN_KEY from airflow.operators.bash import BashOperator @@ -2848,22 +2848,3 @@ def get_extra_env(): echo_task = dag.get_task("echo") assert "get_extra_env" in echo_task.upstream_task_ids - - -def test_executor_config_comparator(): - """ - When comparison raises AttributeError, return False. - This can happen when executor config contains kubernetes objects pickled - under older kubernetes library version. - """ - - class MockAttrError: - def __eq__(self, other): - raise AttributeError('hello') - - a = MockAttrError() - with pytest.raises(AttributeError): - # just verify for ourselves that this throws - assert a == a - assert _executor_config_comparator(a, a) is False - assert _executor_config_comparator('a', 'a') is True diff --git a/tests/utils/test_sqlalchemy.py b/tests/utils/test_sqlalchemy.py index 85414cd14fa82..0038577b8abc8 100644 --- a/tests/utils/test_sqlalchemy.py +++ b/tests/utils/test_sqlalchemy.py @@ -294,3 +294,23 @@ def test_result_processor(self, input): # it was serialized with BaseSerialization (which is the behavior added in #24356 expected['pod_override'] = BaseSerialization()._deserialize(expected['pod_override']) assert result == expected + + def test_compare_values(self): + """ + When comparison raises AttributeError, return False. + This can happen when executor config contains kubernetes objects pickled + under older kubernetes library version. + """ + + class MockAttrError: + def __eq__(self, other): + raise AttributeError('hello') + + a = MockAttrError() + with pytest.raises(AttributeError): + # just verify for ourselves that comparing directly will throw AttributeError + assert a == a + + instance = ExecutorConfigType() + assert instance.compare_values(a, a) is False + assert instance.compare_values('a', 'a') is True