From 61d70fa688b30a913db2a580767ab6b4fe62efd3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 27 Jan 2021 22:40:19 +0200 Subject: [PATCH] Include Unity framework for IDE data only if there are tests in project --- platformio/builder/tools/pioide.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index 16b5c229..de7e0cc8 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -59,10 +59,15 @@ def _dump_includes(env): for g in toolchain_incglobs: includes["toolchain"].extend([os.path.realpath(inc) for inc in glob(g)]) + # include Unity framework if there are tests in project includes["unity"] = [] + auto_install_unity = False + test_dir = env.GetProjectConfig().get_optional_dir("test") + if os.path.isdir(test_dir) and os.listdir(test_dir) != ["README"]: + auto_install_unity = True unity_dir = get_core_package_dir( "tool-unity", - auto_install=os.path.isdir(env.GetProjectConfig().get_optional_dir("test")), + auto_install=auto_install_unity, ) if unity_dir: includes["unity"].append(unity_dir)