kaxil commented on code in PR #44843:
URL: https://github.com/apache/airflow/pull/44843#discussion_r1884266838
##########
tests/models/test_renderedtifields.py:
##########
@@ -158,16 +163,35 @@ def test_get_templated_fields(self, templated_field,
expected_rendered_field, da
assert ti.dag_id == rtif.dag_id
assert ti.task_id == rtif.task_id
assert ti.run_id == rtif.run_id
- assert expected_rendered_field ==
rtif.rendered_fields.get("bash_command")
+ if type(templated_field) is set:
+ # the output order of a set is non-deterministic and can change
per process.
+ # this validation can fail if that happens before stringification,
so we convert to set and compare.
+ assert ast.literal_eval(expected_rendered_field) ==
ast.literal_eval(
+ rtif.rendered_fields.get("bash_command")
+ )
+ else:
+ assert expected_rendered_field ==
rtif.rendered_fields.get("bash_command")
session.add(rtif)
session.flush()
- assert RTIF.get_templated_fields(ti=ti, session=session) == {
- "bash_command": expected_rendered_field,
- "env": None,
- "cwd": None,
- }
+ if type(templated_field) is set:
Review Comment:
Actually I have a better idea to not have to deal with this problem, let me
push a change
--
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]