Skip to content

Commit

Permalink
fixup! Fix the default value for store_dag_code
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxil committed Jun 29, 2020
1 parent 8ec8284 commit c2681d0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
import unittest
import warnings
from collections import OrderedDict
from importlib import reload
from unittest import mock

from airflow import configuration, settings
from airflow import configuration
from airflow.configuration import (
DEFAULT_CONFIG, AirflowConfigException, AirflowConfigParser, conf, expand_env_var, get_airflow_config,
get_airflow_home, parameterized_config, run_command,
Expand All @@ -42,9 +41,6 @@
})
class TestConf(unittest.TestCase):

def tearDown(self) -> None:
reload(settings)

def test_airflow_home_default(self):
with unittest.mock.patch.dict('os.environ'):
if 'AIRFLOW_HOME' in os.environ:
Expand Down Expand Up @@ -606,17 +602,19 @@ def test_confirm_unittest_mod(self):

@conf_vars({("core", "store_serialized_dags"): "True"})
def test_store_dag_code_default_config(self):
reload(settings)
store_serialized_dags = conf.getboolean('core', 'store_serialized_dags', fallback=False)
store_dag_code = conf.getboolean("core", "store_dag_code", fallback=store_serialized_dags)
self.assertFalse(conf.has_option("core", "store_dag_code"))
self.assertTrue(settings.STORE_SERIALIZED_DAGS)
self.assertTrue(settings.STORE_DAG_CODE)
self.assertTrue(store_serialized_dags)
self.assertTrue(store_dag_code)

@conf_vars({
("core", "store_serialized_dags"): "True",
("core", "store_dag_code"): "False"
})
def test_store_dag_code_config_when_set(self):
reload(settings)
store_serialized_dags = conf.getboolean('core', 'store_serialized_dags', fallback=False)
store_dag_code = conf.getboolean("core", "store_dag_code", fallback=store_serialized_dags)
self.assertTrue(conf.has_option("core", "store_dag_code"))
self.assertTrue(settings.STORE_SERIALIZED_DAGS)
self.assertFalse(settings.STORE_DAG_CODE)
self.assertTrue(store_serialized_dags)
self.assertFalse(store_dag_code)

0 comments on commit c2681d0

Please sign in to comment.