ashb commented on a change in pull request #5569: [AIRFLOW-4936] Add context
manager to set temporary config variables.
URL: https://github.com/apache/airflow/pull/5569#discussion_r303376074
##########
File path: tests/contrib/operators/test_ssh_operator.py
##########
@@ -87,15 +86,15 @@ def test_json_command_execution(self):
self.assertIsNotNone(task)
- ti = TaskInstance(
- task=task, execution_date=timezone.utcnow())
- ti.run()
- self.assertIsNotNone(ti.duration)
- self.assertEqual(ti.xcom_pull(task_ids='test', key='return_value'),
- b64encode(b'airflow').decode('utf-8'))
+ with conf_vars({('core', 'enable_xcom_pickling'): 'False'}):
+ ti = TaskInstance(
+ task=task, execution_date=timezone.utcnow())
+ ti.run()
+ self.assertIsNotNone(ti.duration)
+ self.assertEqual(ti.xcom_pull(task_ids='test', key='return_value'),
+ b64encode(b'airflow').decode('utf-8'))
def test_pickle_command_execution(self):
- configuration.conf.set("core", "enable_xcom_pickling", "True")
Review comment:
Use the decorators here too?
(I think I prefer the decorator approach as it means the code is indented
less.)
----------------------------------------------------------------
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]
With regards,
Apache Git Services