feluelle commented on a change in pull request #9394:
URL: https://github.com/apache/airflow/pull/9394#discussion_r455726402
##########
File path: tests/operators/test_python.py
##########
@@ -1222,23 +1230,42 @@ def f(templates_dict):
self._run_as_operator(f, templates_dict={'ds': '{{ ds }}'})
def test_airflow_context(self):
- def f(**context):
- # not serializable
- assert 'var' not in context
- assert 'task_instance' not in context
- assert 'ti' not in context
- # require airflow
- assert 'conf' in context
- assert 'dag' in context
- assert 'dag_run' in context
- assert 'macros' in context
- assert 'task' in context
- # require airflow or pendulum
- assert 'execution_date' in context
- assert 'next_execution_date' in context
- assert 'prev_execution_date' in context
- assert 'prev_execution_date_success' in context
- assert 'prev_start_date_success' in context
+ def f(
+ # basic
+ ds_nodash,
+ inlets,
+ next_ds,
+ next_ds_nodash,
+ outlets,
+ params,
+ prev_ds,
+ prev_ds_nodash,
+ run_id,
+ task_instance_key_str,
+ test_mode,
+ tomorrow_ds,
+ tomorrow_ds_nodash,
+ ts,
+ ts_nodash,
+ ts_nodash_with_tz,
+ yesterday_ds,
+ yesterday_ds_nodash,
+ # pendulum-specific
+ execution_date,
+ next_execution_date,
+ prev_execution_date,
+ prev_execution_date_success,
+ prev_start_date_success,
+ # airflow-specific
+ macros,
+ conf,
+ dag,
+ dag_run,
+ task,
+ # other
+ **context
+ ): # pylint:
disable=unused-argument,too-many-arguments,too-many-locals
+ pass
Review comment:
> I am testing it by forcing to unpack the keys given.
More like a system-test instead of unit-test now.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]