Created
September 8, 2019 06:35
-
-
Save chandulal/7a2fa8e38a3bd9b39c1ba6e52c101c05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_xcoms(self): | |
dag_id = 'hello_world_xcoms' | |
dag = self.dagbag.get_dag(dag_id) | |
push_to_xcoms_task = dag.get_task('push_to_xcoms') | |
pull_from_xcoms_task = dag.get_task('pull_from_xcoms') | |
execution_date = datetime.now() | |
push_to_xcoms_ti = TaskInstance(task=push_to_xcoms_task, execution_date=execution_date) | |
context = push_to_xcoms_ti.get_template_context() | |
push_to_xcoms_task.execute(context) | |
pull_from_xcoms_ti = TaskInstance(task=pull_from_xcoms_task, execution_date=execution_date) | |
result = pull_from_xcoms_ti.xcom_pull(key="dummyKey") | |
self.assertEqual(result, 'dummyValue') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment