This is an automated email from the ASF dual-hosted git repository. taragolis pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push: new 0a98435760 Resolve deprecations in Python sensors/operators/decorators (#39241) 0a98435760 is described below commit 0a98435760a850b69d672f25c3b2f9d86afaf411 Author: Andrey Anshin <andrey.ans...@taragol.is> AuthorDate: Fri May 3 11:49:57 2024 +0400 Resolve deprecations in Python sensors/operators/decorators (#39241) --- tests/decorators/test_python.py | 2 ++ tests/decorators/test_python_virtualenv.py | 6 ++-- tests/deprecations_ignore.yml | 55 ------------------------------ tests/operators/test_python.py | 1 + 4 files changed, 6 insertions(+), 58 deletions(-) diff --git a/tests/decorators/test_python.py b/tests/decorators/test_python.py index 5175c508ac..1561b8224d 100644 --- a/tests/decorators/test_python.py +++ b/tests/decorators/test_python.py @@ -447,6 +447,7 @@ class TestAirflowTaskDecorator(BasePythonTest): start_date=timezone.utcnow(), execution_date=DEFAULT_DATE, state=State.RUNNING, + data_interval=self.dag.timetable.infer_manual_data_interval(run_after=DEFAULT_DATE), ) ret.operator.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) @@ -506,6 +507,7 @@ class TestAirflowTaskDecorator(BasePythonTest): start_date=timezone.utcnow(), execution_date=DEFAULT_DATE, state=State.RUNNING, + data_interval=self.dag.timetable.infer_manual_data_interval(run_after=DEFAULT_DATE), ) bigger_number.operator.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) diff --git a/tests/decorators/test_python_virtualenv.py b/tests/decorators/test_python_virtualenv.py index aff442589e..15f37d9a46 100644 --- a/tests/decorators/test_python_virtualenv.py +++ b/tests/decorators/test_python_virtualenv.py @@ -32,7 +32,7 @@ log = logging.getLogger(__name__) pytestmark = pytest.mark.db_test DEFAULT_DATE = timezone.datetime(2016, 1, 1) -PYTHON_VERSION = sys.version_info[0] +PYTHON_VERSION = f"{sys.version_info.major}{sys.version_info.minor}" class TestPythonVirtualenvDecorator: @@ -252,7 +252,7 @@ class TestPythonVirtualenvDecorator: ret.operator.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) def test_python_3_cloudpickle(self, dag_maker): - @task.virtualenv(python_version=3, use_cloudpickle=False, requirements=["cloudpickle"]) + @task.virtualenv(python_version="3", use_cloudpickle=False, requirements=["cloudpickle"]) def f(): import sys @@ -269,7 +269,7 @@ class TestPythonVirtualenvDecorator: ret.operator.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) def test_python_3_dill(self, dag_maker): - @task.virtualenv(python_version=3, use_dill=False, requirements=["dill"]) + @task.virtualenv(python_version="3", use_dill=False, requirements=["dill"]) def f(): import sys diff --git a/tests/deprecations_ignore.yml b/tests/deprecations_ignore.yml index 47eb895104..2887cd13a3 100644 --- a/tests/deprecations_ignore.yml +++ b/tests/deprecations_ignore.yml @@ -184,17 +184,6 @@ - tests/operators/test_datetime.py::TestBranchDateTimeOperator::test_no_target_time - tests/operators/test_latest_only_operator.py::TestLatestOnlyOperator::test_not_skipping_external - tests/operators/test_latest_only_operator.py::TestLatestOnlyOperator::test_skipping_non_latest -- tests/operators/test_python.py::TestBranchOperator::test_clear_skipped_downstream_task -- tests/operators/test_python.py::TestBranchOperator::test_empty_branch -- tests/operators/test_python.py::TestBranchOperator::test_with_dag_run -- tests/operators/test_python.py::TestBranchOperator::test_with_skip_in_branch_downstream_dependencies -- tests/operators/test_python.py::TestBranchOperator::test_with_skip_in_branch_downstream_dependencies2 -- tests/operators/test_python.py::TestBranchOperator::test_xcom_push -- tests/operators/test_python.py::TestShortCircuitOperator::test_clear_skipped_downstream_task -- tests/operators/test_python.py::TestShortCircuitOperator::test_mapped_xcom_push_skipped_tasks -- tests/operators/test_python.py::TestShortCircuitOperator::test_short_circuiting -- tests/operators/test_python.py::TestShortCircuitOperator::test_xcom_push -- tests/operators/test_python.py::TestShortCircuitOperator::test_xcom_push_skipped_tasks - tests/operators/test_subdag_operator.py::TestSubDagOperator::test_execute_create_dagrun_wait_until_success - tests/operators/test_subdag_operator.py::TestSubDagOperator::test_execute_create_dagrun_with_conf - tests/operators/test_subdag_operator.py::TestSubDagOperator::test_execute_dagrun_failed @@ -227,29 +216,6 @@ - tests/operators/test_weekday.py::TestBranchDayOfWeekOperator::test_branch_xcom_push_true_branch -# BranchPythonVenv -- tests/operators/test_python.py::TestBranchPythonVirtualenvOperator::test_clear_skipped_downstream_task -- tests/operators/test_python.py::TestBranchPythonVirtualenvOperator::test_with_dag_run -- tests/operators/test_python.py::TestBranchPythonVirtualenvOperator::test_with_skip_in_branch_downstream_dependencies -- tests/operators/test_python.py::TestBranchPythonVirtualenvOperator::test_with_skip_in_branch_downstream_dependencies2 -- tests/operators/test_python.py::TestBranchPythonVirtualenvOperator::test_xcom_push - - -# BranchExternalPython -- tests/operators/test_python.py::TestBranchExternalPythonOperator::test_clear_skipped_downstream_task -- tests/operators/test_python.py::TestBranchExternalPythonOperator::test_with_dag_run -- tests/operators/test_python.py::TestBranchExternalPythonOperator::test_with_skip_in_branch_downstream_dependencies -- tests/operators/test_python.py::TestBranchExternalPythonOperator::test_with_skip_in_branch_downstream_dependencies2 -- tests/operators/test_python.py::TestBranchExternalPythonOperator::test_xcom_push - - -# PythonVenv - - -# PlainAsserts -- tests/operators/test_python.py::TestPythonVirtualenvOperator::test_airflow_context - - # Serialization - tests/serialization/test_dag_serialization.py::TestStringifiedDAGs::test_custom_dep_detector - tests/serialization/test_dag_serialization.py::TestStringifiedDAGs::test_dag_params_roundtrip @@ -333,27 +299,6 @@ - tests/dag_processing/test_processor.py::TestDagFileProcessor::test_execute_on_failure_callbacks_without_dag - tests/dag_processing/test_processor.py::TestDagFileProcessor::test_failure_callbacks_should_not_drop_hostname - tests/dag_processing/test_processor.py::TestDagFileProcessor::test_process_file_should_failure_callback -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_fail_multiple_outputs_key_type -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_fail_multiple_outputs_no_dict -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_manual_multiple_outputs_false_with_typings -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_multiple_outputs -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_multiple_outputs_empty_dict -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_multiple_outputs_ignore_typing -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_multiple_outputs_return_none -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_python_callable_arguments_are_templatized -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_python_callable_keyword_arguments_are_templatized -- tests/decorators/test_python.py::TestAirflowTaskDecorator::test_xcom_arg -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_no_system_site_packages -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_python_3_cloudpickle -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_python_3_dill -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_system_site_packages_cloudpickle -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_system_site_packages_dill -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_unpinned_requirements_cloudpickle -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_unpinned_requirements_dill -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_with_requirements_file_cloudpickle -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_with_requirements_file_dill -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_with_requirements_pinned_cloudpickle -- tests/decorators/test_python_virtualenv.py::TestPythonVirtualenvDecorator::test_with_requirements_pinned_dill - tests/sensors/test_external_task_sensor.py::TestExternalTaskSensor::test_external_dag_sensor - tests/sensors/test_external_task_sensor.py::TestExternalTaskSensor::test_external_dag_sensor_log - tests/sensors/test_external_task_sensor.py::TestExternalTaskSensor::test_external_dag_sensor_soft_fail_as_skipped diff --git a/tests/operators/test_python.py b/tests/operators/test_python.py index d071ac69f3..274abd6570 100644 --- a/tests/operators/test_python.py +++ b/tests/operators/test_python.py @@ -133,6 +133,7 @@ class BasePythonTest: session=self.dag_maker.session, execution_date=self.default_date, run_type=DagRunType.MANUAL, + data_interval=(self.default_date, self.default_date), ) def create_ti(self, fn, **kwargs) -> TI: