mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Resolved an issue where native tests would fail if a custom program name was specified // Resolve #4546
This commit is contained in:
@ -28,6 +28,7 @@ PlatformIO Core 6
|
||||
* Resolved an issue where the `build_cache_dir <https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/build_cache_dir.html>`__ setting was not being recognized consistently across multiple environments (`issue #4574 <https://github.com/platformio/platformio-core/issues/4574>`_)
|
||||
* Fixed an issue where organization details could not be updated using the `pio org update <https://docs.platformio.org/en/latest/core/userguide/org/cmd_update.html>`__ command
|
||||
* Resolved an issue where the incorrect debugging environment was generated for VSCode in "Auto" mode (`issue #4597 <https://github.com/platformio/platformio-core/issues/4597>`_)
|
||||
* Resolved an issue where native tests would fail if a custom program name was specified (`issue #4546 <https://github.com/platformio/platformio-core/issues/4546>`_)
|
||||
|
||||
6.1.6 (2023-01-23)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
@ -18,7 +18,7 @@ from platformio.exception import ReturnErrorCode
|
||||
from platformio.platform.factory import PlatformFactory
|
||||
from platformio.test.exception import UnitTestSuiteError
|
||||
from platformio.test.result import TestCase, TestStatus
|
||||
from platformio.test.runners.readers.program import ProgramTestOutputReader
|
||||
from platformio.test.runners.readers.native import NativeTestOutputReader
|
||||
from platformio.test.runners.readers.serial import SerialTestOutputReader
|
||||
|
||||
CTX_META_TEST_IS_RUNNING = __name__ + ".test_running"
|
||||
@ -160,7 +160,7 @@ class TestRunnerBase:
|
||||
return None
|
||||
click.secho("Testing...", bold=True)
|
||||
test_port = self.get_test_port()
|
||||
program_conds = [
|
||||
native_conds = [
|
||||
not self.platform.is_embedded()
|
||||
and (not test_port or "://" not in test_port),
|
||||
self.project_config.get(
|
||||
@ -168,8 +168,8 @@ class TestRunnerBase:
|
||||
),
|
||||
]
|
||||
reader = (
|
||||
ProgramTestOutputReader(self)
|
||||
if any(program_conds)
|
||||
NativeTestOutputReader(self)
|
||||
if any(native_conds)
|
||||
else SerialTestOutputReader(self)
|
||||
)
|
||||
return reader.begin()
|
||||
|
@ -24,6 +24,7 @@ from platformio.compat import (
|
||||
get_filesystem_encoding,
|
||||
get_locale_encoding,
|
||||
)
|
||||
from platformio.project.helpers import load_build_metadata
|
||||
from platformio.test.exception import UnitTestError
|
||||
|
||||
EXITING_TIMEOUT = 5 # seconds
|
||||
@ -56,7 +57,7 @@ class ProgramProcessProtocol(asyncio.SubprocessProtocol):
|
||||
self._exit_timer.cancel()
|
||||
|
||||
|
||||
class ProgramTestOutputReader:
|
||||
class NativeTestOutputReader:
|
||||
def __init__(self, test_runner):
|
||||
self.test_runner = test_runner
|
||||
self.aio_loop = (
|
||||
@ -78,6 +79,13 @@ class ProgramTestOutputReader:
|
||||
"program.exe" if IS_WINDOWS else "program",
|
||||
)
|
||||
]
|
||||
# if user changed PROGNAME
|
||||
if not os.path.exists(cmd[0]):
|
||||
build_data = load_build_metadata(
|
||||
os.getcwd(), self.test_runner.test_suite.env_name, cache=True
|
||||
)
|
||||
if build_data:
|
||||
cmd[0] = build_data["prog_path"]
|
||||
if self.test_runner.options.program_args:
|
||||
cmd.extend(self.test_runner.options.program_args)
|
||||
return cmd
|
Reference in New Issue
Block a user