From 32e440bec7f019ac4cf6d2ccf67e805acf07e399 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 28 Jun 2022 12:59:23 +0300 Subject: [PATCH] Fixed an issue when testing results were wrong in the verbose mode // Resolve #4336 --- HISTORY.rst | 34 ++++++++++++++++----------- platformio/test/runners/doctest.py | 5 ++-- platformio/test/runners/googletest.py | 5 ++-- platformio/test/runners/unity.py | 10 ++++---- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 22461dad..be4dcdc0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,11 +16,13 @@ PlatformIO Core 6 6.0.3 (2022-??-??) ~~~~~~~~~~~~~~~~~~ -* **Device Monitor** +* **Device Manager** - - Automatically reconnect if a connection fails + - Automatically reconnect device monitor if a connection fails - Added new `pio device monitor --no-reconnect `__ option to disable automatic reconnection - - Handle disconnects more gracefully (`issue #3939 `_) + - Handle device monitor disconnects more gracefully (`issue #3939 `_) + - Improved a serial port finder for `Black Magic Probe `__ (`issue #4023 `_) + - Improved a serial port finder for a board with predefined HWIDs - Replaced ``monitor_flags`` with independent project configuration options: `monitor_parity `__, `monitor_eol `__, `monitor_raw `__, `monitor_echo `__ - Fixed an issue when the monitor filters were not applied in their order (`issue #4320 `_) @@ -30,18 +32,22 @@ PlatformIO Core 6 - Merged the "building" stage with "uploading" for the embedded target (`issue #4307 `_) - Do not resolve dependencies from the project "src" folder when the `test_build_src `__ option is not enabled - Fixed an issue when a custom `pio test --project-config `__ was not handled properly (`issue #4299 `_) + - Fixed an issue when testing results were wrong in the verbose mode (`issue #4336 `_) -* Documented `Stringification `__ – converting a macro argument into a string constant (`issue #4310 `_) -* Added ``env.StringifyMacro(value)`` helper function for the `Advanced Scripting `__ -* Allowed to ``Import("projenv")`` in a library extra script (`issue #4305 `_) -* Improved a serial port finder for `Black Magic Probe `__ (`issue #4023 `_) -* Improved a serial port finder for a board with predefined HWIDs -* Warn about incompatible Bash version for the `Shell Completion `__ (`issue #4326 `_) -* Fixed an issue when the `build_unflags `__ operation ignores a flag value (`issue #4309 `_) -* Fixed an issue when the `build_unflags `__ option was not applied to the ``ASPPFLAGS`` scope -* Fixed an issue on Windows OS when flags were wrapped to the temporary file while generating the `Compilation database "compile_commands.json" `__ -* Fixed an issue with the `LDF `__ when recursively scanning dependencies in the ``chain`` mode -* Fixed a "PermissionError" on Windows when running "clean" or "cleanall" targets (`issue #4331 `_) +* **Build System** + + - Documented `Stringification `__ – converting a macro argument into a string constant (`issue #4310 `_) + - Added ``env.StringifyMacro(value)`` helper function for the `Advanced Scripting `__ + - Allowed to ``Import("projenv")`` in a library extra script (`issue #4305 `_) + - Fixed an issue when the `build_unflags `__ operation ignores a flag value (`issue #4309 `_) + - Fixed an issue when the `build_unflags `__ option was not applied to the ``ASPPFLAGS`` scope + - Fixed an issue on Windows OS when flags were wrapped to the temporary file while generating the `Compilation database "compile_commands.json" `__ + - Fixed an issue with the `LDF `__ when recursively scanning dependencies in the ``chain`` mode + - Fixed a "PermissionError" on Windows when running "clean" or "cleanall" targets (`issue #4331 `_) + +* **Miscellaneous** + + - Warn about incompatible Bash version for the `Shell Completion `__ (`issue #4326 `_) 6.0.2 (2022-06-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/test/runners/doctest.py b/platformio/test/runners/doctest.py index 2360c4e6..52a0916f 100644 --- a/platformio/test/runners/doctest.py +++ b/platformio/test/runners/doctest.py @@ -113,9 +113,10 @@ class DoctestTestRunner(TestRunnerBase): click.echo(line, nl=False) test_case = self._tc_parser.parse(line) - if test_case and not self.options.verbose: - click.echo(test_case.humanize()) + if test_case: self.test_suite.add_case(test_case) + if not self.options.verbose: + click.echo(test_case.humanize()) if "[doctest] Status:" in line: self.test_suite.on_finish() diff --git a/platformio/test/runners/googletest.py b/platformio/test/runners/googletest.py index 9c8beba2..5268d72f 100644 --- a/platformio/test/runners/googletest.py +++ b/platformio/test/runners/googletest.py @@ -102,9 +102,10 @@ class GoogletestTestRunner(TestRunnerBase): click.echo(line, nl=False) test_case = self._tc_parser.parse(line) - if test_case and not self.options.verbose: - click.echo(test_case.humanize()) + if test_case: self.test_suite.add_case(test_case) + if not self.options.verbose: + click.echo(test_case.humanize()) if "Global test environment tear-down" in line: self.test_suite.on_finish() diff --git a/platformio/test/runners/unity.py b/platformio/test/runners/unity.py index e048c1ed..39418857 100644 --- a/platformio/test/runners/unity.py +++ b/platformio/test/runners/unity.py @@ -265,8 +265,10 @@ void unityOutputComplete(void) { unittest_uart_end(); } return test_case = self.parse_test_case(line) - if test_case and not self.options.verbose: - click.echo(test_case.humanize()) + if test_case: + self.test_suite.add_case(test_case) + if not self.options.verbose: + click.echo(test_case.humanize()) if all(s in line for s in ("Tests", "Failures", "Ignored")): self.test_suite.on_finish() @@ -286,12 +288,10 @@ void unityOutputComplete(void) { unittest_uart_end(); } source = TestCaseSource( filename=data["source_file"], line=int(data.get("source_line")) ) - test_case = TestCase( + return TestCase( name=data.get("name").strip(), status=TestStatus.from_string(data.get("status")), message=(data.get("message") or "").strip() or None, stdout=line, source=source, ) - self.test_suite.add_case(test_case) - return test_case