From 7c271c820742f90967fe2aa5a139e29ec4266167 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 Feb 2021 18:53:26 +0200 Subject: [PATCH] Better detecting of native dev-platform for unit testing // Resolve #3851 --- platformio/commands/test/command.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/platformio/commands/test/command.py b/platformio/commands/test/command.py index 8ebda932..07f95226 100644 --- a/platformio/commands/test/command.py +++ b/platformio/commands/test/command.py @@ -25,6 +25,7 @@ from tabulate import tabulate from platformio import app, exception, fs, util from platformio.commands.test.embedded import EmbeddedTestProcessor from platformio.commands.test.native import NativeTestProcessor +from platformio.platform.factory import PlatformFactory from platformio.project.config import ProjectConfig @@ -140,9 +141,9 @@ def cli( # pylint: disable=redefined-builtin print_processing_header(testname, envname) cls = ( - NativeTestProcessor - if config.get(section, "platform") == "native" - else EmbeddedTestProcessor + EmbeddedTestProcessor + if is_embedded_platform(config.get(section, "platform")) + else NativeTestProcessor ) tp = cls( ctx, @@ -194,6 +195,12 @@ def get_test_names(test_dir): return names +def is_embedded_platform(name): + if not name: + return False + return PlatformFactory.new(name).is_embedded() + + def print_processing_header(test, env): click.echo( "Processing %s in %s environment"