potiuk commented on code in PR #35546:
URL: https://github.com/apache/airflow/pull/35546#discussion_r1387788704
##########
tests/serialization/test_dag_serialization.py:
##########
@@ -2035,20 +2035,18 @@ def test_params_serialize_default(self):
assert param.description == "hello"
assert param.schema == {"type": "string"}
- def test_not_templateable_fields_in_serialized_dag(
- self,
- ):
+ def test_not_templateable_fields_in_serialized_dag(self):
"""
- Test that when we use not templateable fields, an Airflow exception
is raised.
+ Test that when we use not templateable fields, an Airflow exception is
raised.
"""
class TestOperator(BaseOperator):
- template_fields = ("execution_timeout",)
+ template_fields = ("email", "execution_timeout")
dag = DAG("test_not_templateable_fields", start_date=datetime(2019, 8,
1))
with dag:
TestOperator(task_id="test",
execution_timeout=timedelta(seconds=10))
- with pytest.raises(AirflowException, match="Cannot template
BaseOperator fields: execution_timeout"):
+ with pytest.raises(AirflowException, match="Cannot template
BaseOperator field: 'execution_timeout'"):
SerializedDAG.to_dict(dag)
Review Comment:
A nice addition here would be to add a test where you actually add the email
with a jinja template and run render_template_fields on task instance and see
it rendered.
--
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]