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)