mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 10:37:13 +02:00
Better detecting of native dev-platform for unit testing // Resolve #3851
This commit is contained in:
@ -25,6 +25,7 @@ from tabulate import tabulate
|
|||||||
from platformio import app, exception, fs, util
|
from platformio import app, exception, fs, util
|
||||||
from platformio.commands.test.embedded import EmbeddedTestProcessor
|
from platformio.commands.test.embedded import EmbeddedTestProcessor
|
||||||
from platformio.commands.test.native import NativeTestProcessor
|
from platformio.commands.test.native import NativeTestProcessor
|
||||||
|
from platformio.platform.factory import PlatformFactory
|
||||||
from platformio.project.config import ProjectConfig
|
from platformio.project.config import ProjectConfig
|
||||||
|
|
||||||
|
|
||||||
@ -140,9 +141,9 @@ def cli( # pylint: disable=redefined-builtin
|
|||||||
print_processing_header(testname, envname)
|
print_processing_header(testname, envname)
|
||||||
|
|
||||||
cls = (
|
cls = (
|
||||||
NativeTestProcessor
|
EmbeddedTestProcessor
|
||||||
if config.get(section, "platform") == "native"
|
if is_embedded_platform(config.get(section, "platform"))
|
||||||
else EmbeddedTestProcessor
|
else NativeTestProcessor
|
||||||
)
|
)
|
||||||
tp = cls(
|
tp = cls(
|
||||||
ctx,
|
ctx,
|
||||||
@ -194,6 +195,12 @@ def get_test_names(test_dir):
|
|||||||
return names
|
return names
|
||||||
|
|
||||||
|
|
||||||
|
def is_embedded_platform(name):
|
||||||
|
if not name:
|
||||||
|
return False
|
||||||
|
return PlatformFactory.new(name).is_embedded()
|
||||||
|
|
||||||
|
|
||||||
def print_processing_header(test, env):
|
def print_processing_header(test, env):
|
||||||
click.echo(
|
click.echo(
|
||||||
"Processing %s in %s environment"
|
"Processing %s in %s environment"
|
||||||
|
Reference in New Issue
Block a user