Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions opl/junit_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import unicodedata
import junitparser
import urllib3
import re

import requests

Expand Down Expand Up @@ -63,6 +64,14 @@ def _remove_control_characters(self, s):
ch for ch in s if unicodedata.category(ch)[0] != "C" or ch == "\n"
)

def trim_string_fn(self, data, trim_length):
matches = list(re.finditer(r"\S+", data))
if len(matches) <= trim_length:
return data
# Get the start index of the Nth-to-last word
start_index = matches[-trim_length].start()
return data[start_index:]

def add_to_suite(self, suite_name, new):
case = TestCaseWithProp(new["name"])

Expand Down Expand Up @@ -102,6 +111,7 @@ def add_to_suite(self, suite_name, new):
except ValueError as e:
logging.error(f"Failed to load {new['system-err'].name} file: {e}")

case.system_out = self.trim_string_fn(case.system_out, 1000)
duration = (new["end"] - new["start"]).total_seconds()
case.time = duration

Expand Down