mik-laj commented on a change in pull request #7249: [AIRFLOW-6626] Add email on failure or retry to default config URL: https://github.com/apache/airflow/pull/7249#discussion_r373386436
########## File path: tests/models/test_baseoperator.py ########## @@ -248,6 +249,13 @@ def test_custom_resources(self): self.assertEqual(task.resources.cpus.qty, 1) self.assertEqual(task.resources.ram.qty, 1024) + @conf_vars({('email', 'default_email_on_retry'): 'True', + ('email', 'default_email_on_failure'): 'False'}) + def test_default_email_on_actions(self): + test_task = DummyOperator(task_id='test_default_email_on_actions') + assert test_task.email_on_retry is True + assert test_task.email_on_failure is False Review comment: https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments Default arguments are cached, so you have to reload the module Example: ``` @conf_vars({("core", "executor"): "CeleryExecutor"}) def setUpClass(cls): importlib.reload(cli) cls.parser = cli.CLIFactory.get_parser() ``` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services