From 69de40c409627740e1c27850652e9979690a4ee6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 2 Jul 2019 12:21:06 +0300 Subject: [PATCH] Fix an issue when empty multiple values for project option were not casted to list // Resolve #2734 --- platformio/project/config.py | 2 +- tests/test_projectconf.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/platformio/project/config.py b/platformio/project/config.py index ee7e71d1..dc455809 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -243,7 +243,7 @@ class ProjectConfig(object): if not option_meta: return value or default - if value and option_meta.multiple: + if option_meta.multiple: value = self.parse_multi_values(value) if option_meta.sysenvvar: diff --git a/tests/test_projectconf.py b/tests/test_projectconf.py index 38725f8a..882c2dd6 100644 --- a/tests/test_projectconf.py +++ b/tests/test_projectconf.py @@ -42,6 +42,7 @@ lib_ignore = LibIgnoreCustom [env:base] build_flags = ${custom.debug_flags} ${custom.extra_flags} +targets = """ EXTRA_ENVS_CONFIG = """ @@ -102,7 +103,7 @@ def test_real_config(tmpdir): # options assert config.options(env="base") == [ - "build_flags", "monitor_speed", "lib_deps", "lib_ignore" + "build_flags", "targets", "monitor_speed", "lib_deps", "lib_ignore" ] # has_option @@ -126,6 +127,7 @@ def test_real_config(tmpdir): assert config.get("env:extra_2", "upload_port") == "/dev/extra_2/port" # getraw + assert config.getraw("env:base", "targets") == "" assert config.getraw("env:extra_1", "lib_deps") == "574" assert config.getraw("env:extra_1", "build_flags") == "-lc -lm -D DEBUG=1" @@ -148,6 +150,16 @@ def test_real_config(tmpdir): ("extra_flags", "-L /usr/local/lib"), ("lib_ignore", "LibIgnoreCustom") ] # yapf: disable + print(config.items(env="base")) + assert config.items(env="base") == [ + ("build_flags", [ + "-D DEBUG=1 -L /usr/local/lib", "-DSYSENVDEPS1 -DSYSENVDEPS2"]), + ("targets", []), + ("monitor_speed", "115200"), + ("lib_deps", ["Lib1", "Lib2"]), + ("lib_ignore", ["LibIgnoreCustom"]), + ("upload_port", "/dev/sysenv/port") + ] # yapf: disable assert config.items(env="extra_1") == [ ("build_flags", ["-lc -lm -D DEBUG=1", "-DSYSENVDEPS1 -DSYSENVDEPS2"]), ("lib_deps", ["574"]),