Skip to content

Commit

Permalink
trunner: change style of printing flash output
Browse files Browse the repository at this point in the history
JIRA: CI-448
  • Loading branch information
mateusz-bloch authored and damianloew committed Apr 18, 2024
1 parent e6efa70 commit d6bcaf7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions trunner/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from trunner.ctx import TestContext
from trunner.dut import Dut
from trunner.harness import HarnessError, FlashError
from trunner.text import bold, green, red, yellow, magenta
from trunner.text import green, red, yellow, magenta
from trunner.types import Status, TestOptions, TestResult, TestStage, is_github_actions, get_ci_url


Expand Down Expand Up @@ -143,22 +143,22 @@ def parse_tests(self) -> Sequence[TestOptions]:
def flash(self) -> TestResult:
"""Flashes the device under test."""

print("Flashing an image to device...")

# report flashing as a test result to include in export (especially useful when failed)
result = TestResult("flash")

self._print_test_header_begin(result)

try:
result.set_stage(TestStage.RUN)
self.target.flash_dut()
result.set_stage(TestStage.DONE)
except (FlashError, HarnessError) as exc:
# the newline is needed to avoid printing exception in the same line as plo prompt
print(bold("\nERROR WHILE FLASHING THE DEVICE"))
print(exc)
result.fail_harness_exception(exc)
result.fail(str(exc))

self._print_test_header_end(result)

print(result.to_str(self.ctx.verbosity), end="", flush=True)

print("Done!")
return result

def _print_test_header_end(self, test: TestOptions):
Expand Down

0 comments on commit d6bcaf7

Please sign in to comment.