Skip to content

Commit

Permalink
trunner: prevent printing escape codes in output from fail
Browse files Browse the repository at this point in the history
JIRA: CI-460
  • Loading branch information
mateusz-bloch committed Jun 12, 2024
1 parent c28bc0c commit c49e59c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions trunner/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ def _failed_traceback(self) -> List[str]:
return [bold("ASSERTION TRACEBACK (most recent call last):"), "".join(tb_info)]

def _failed_before_buffer(self, dut) -> str:
return dut.before.replace("\r", "")
before = re.sub(r'\x1b\[[0-9]*[A-Za-z]', '', dut.before)
return before.replace("\r", "")

def _failed_buffer(self, dut) -> str:
return dut.buffer.replace("\r", "")
buffer = re.sub(r'\x1b\[[0-9]*[A-Zaq-z]', '', dut.buffer)
return buffer.replace("\r", "")

def fail_pexpect(self, dut, exc):
self.fail(summary="Pexpect failure")
Expand Down

0 comments on commit c49e59c

Please sign in to comment.