Skip to content

Commit

Permalink
[BugFix] Fix max length (pytorch#1233)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Jun 5, 2023
1 parent c0196ad commit 1c91927
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ def pytest_sessionfinish(maxprint=50):
Call times:
===========
"""
maxchar = max(*[len(key) for key in CALL_TIMES.keys()])
keys = list(CALL_TIMES.keys())
if len(keys) > 1:
maxchar = max(*[len(key) for key in keys])
else:
maxchar = len(keys[0])
for i, (key, item) in enumerate(
sorted(CALL_TIMES.items(), key=lambda x: x[1], reverse=True)
):
spaces = " " + " " * (maxchar - len(key))
out_str += f"\t{key}{spaces}{item: 4.4f}\n"
out_str += f"\t{key}{spaces}{item: 4.4f}s\n"
if i == maxprint - 1:
break
print(out_str)
Expand Down

0 comments on commit 1c91927

Please sign in to comment.