From 614693caf1f87bc888327a31a2aec9354de4e7e6 Mon Sep 17 00:00:00 2001 From: Philippe Duval Date: Mon, 13 Aug 2018 18:02:01 -0400 Subject: [PATCH] Add test_configs to tox. --- dash/_configs.py | 20 ++++++++++---------- dash/dash.py | 6 +++--- tox.ini | 3 +++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/dash/_configs.py b/dash/_configs.py index 5f5d79f857..6849f5be8d 100644 --- a/dash/_configs.py +++ b/dash/_configs.py @@ -22,7 +22,7 @@ def env_configs(): )}) -def choose_config(config_name, init, env, default=None): +def get_config(config_name, init, env, default=None): if init is not None: return init @@ -51,17 +51,17 @@ def pathname_configs(url_base_pathname=None, ''' environ_configs = environ_configs or env_configs() - url_base_pathname = choose_config('url_base_pathname', - url_base_pathname, - environ_configs) + url_base_pathname = get_config('url_base_pathname', + url_base_pathname, + environ_configs) - routes_pathname_prefix = choose_config('routes_pathname_prefix', - routes_pathname_prefix, - environ_configs) + routes_pathname_prefix = get_config('routes_pathname_prefix', + routes_pathname_prefix, + environ_configs) - requests_pathname_prefix = choose_config('requests_pathname_prefix', - requests_pathname_prefix, - environ_configs) + requests_pathname_prefix = get_config('requests_pathname_prefix', + requests_pathname_prefix, + environ_configs) if url_base_pathname is not None and requests_pathname_prefix is not None: raise exceptions.InvalidConfig( diff --git a/dash/dash.py b/dash/dash.py index 6c43a48ea2..36ad90ff13 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -118,18 +118,18 @@ def __init__( self.url_base_pathname = url_base_pathname self.config = _AttributeDict({ - 'suppress_callback_exceptions': _configs.choose_config( + 'suppress_callback_exceptions': _configs.get_config( 'suppress_callback_exceptions', suppress_callback_exceptions, env_configs, False ), 'routes_pathname_prefix': routes_pathname_prefix, 'requests_pathname_prefix': requests_pathname_prefix, - 'include_assets_files': _configs.choose_config( + 'include_assets_files': _configs.get_config( 'include_assets_files', include_assets_files, env_configs, True), - 'assets_external_path': _configs.choose_config( + 'assets_external_path': _configs.get_config( 'assets_external_path', assets_external_path, env_configs, ''), }) diff --git a/tox.ini b/tox.ini index e3e73acfe7..d759241370 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ commands = python -m unittest tests.development.test_component_loader python -m unittest tests.test_integration python -m unittest tests.test_resources + python -m unittest tests.test_configs flake8 dash setup.py pylint dash setup.py @@ -25,5 +26,7 @@ commands = python -m unittest tests.development.test_component_loader python -m unittest tests.test_integration python -m unittest tests.test_resources + python -m unittest tests.test_configs + flake8 dash setup.py pylint dash setup.py