diff --git a/poetry/config/config.py b/poetry/config/config.py index 37844aa1fc9..62ffa663493 100644 --- a/poetry/config/config.py +++ b/poetry/config/config.py @@ -140,6 +140,7 @@ def _get_normalizer(self, name: str) -> Callable: "virtualenvs.create", "virtualenvs.in-project", "virtualenvs.options.always-copy", + "experimental.new-installer", "installer.parallel", }: return boolean_normalizer diff --git a/tests/config/test_config.py b/tests/config/test_config.py index f3b13f23003..a5baaecb3ea 100644 --- a/tests/config/test_config.py +++ b/tests/config/test_config.py @@ -1,7 +1,22 @@ import os +import re import pytest +from poetry.config.config import Config + + +def get_boolean_options(config=None): + if config is None: + config = Config.default_config + + for k, v in config.items(): + if isinstance(v, bool) or v is None: + yield k + if isinstance(v, dict): + for suboption in get_boolean_options(v): + yield "{}.{}".format(k, suboption) + @pytest.mark.parametrize( ("name", "value"), [("installer.parallel", True), ("virtualenvs.create", True)] @@ -17,13 +32,12 @@ def test_config_get_processes_depended_on_values(config, config_cache_dir): @pytest.mark.parametrize( ("name", "env_value", "value"), [ - ("installer.parallel", "true", True), - ("installer.parallel", "false", False), - ("virtualenvs.create", "true", True), - ("virtualenvs.create", "false", False), + (name, env_value, value) + for name in get_boolean_options() + for env_value, value in [("true", True), ("false", False)] ], ) def test_config_get_from_environment_variable(config, environ, name, env_value, value): - env_var = "POETRY_{}".format("_".join(k.upper() for k in name.split("."))) + env_var = "POETRY_{}".format(re.sub("[.-]+", "_", name).upper()) os.environ[env_var] = env_value assert config.get(name) is value