Skip to content

Commit

Permalink
Fix news fragment, and coding suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
tossegus authored and LarsAsplund committed Jun 10, 2024
1 parent a065491 commit 0ac6029
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/news.d/1025.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update time reporting from test results. Also add timestamps when starting tests.
5 changes: 0 additions & 5 deletions docs/release_notes/4.8.0.rst

This file was deleted.

7 changes: 4 additions & 3 deletions vunit/test/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,27 @@ def get_parsed_time(time_in, max_time=0):

(minutes, seconds) = divmod(time_in, 60)
(hours, minutes) = divmod(minutes, 60)

if max(time_in, max_time) >= 3600:
# If the longest test took 10 hours or more, pad the string to take this
# into account.
padding = 5 if (max_time / 3600) % 60 >= 10 else 4
padding = len(f"{int(max_time // 3600)} h ")
if hours > 0:
time_str += f"{int(hours)} h ".rjust(padding)
else:
time_str += " " * padding
if max(time_in, max_time) >= 60:
# If the longest test took an hour (or more), or the longest test took
# 10 minutes or more, pad the string to take this into account.
padding = 7 if (max_time >= 3600) or ((max_time / 60) % 60 >= 10) else 6
padding = 7 if (max_time / 60 >= 10) else 6
if minutes > 0:
time_str += f"{int(minutes)} min ".rjust(padding)
else:
time_str += " " * padding

# If the longest test took a minute (or more), or the longest test
# took 10 seconds or more, pad the string to take this into account.
padding = 6 if (max_time >= 60) or (max_time % 60 >= 10) else 5
padding = 6 if (max_time >= 10) else 5
time_str += f"{seconds:2.1f} s".rjust(padding)

return time_str
Expand Down

0 comments on commit 0ac6029

Please sign in to comment.