Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Format session duration in human-readable form #265

Merged
merged 1 commit into from
Apr 10, 2023
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
4 changes: 2 additions & 2 deletions pytest_sugar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from _pytest.main import Session
from _pytest.nodes import Item
from _pytest.reports import BaseReport, CollectReport, TestReport
from _pytest.terminal import TerminalReporter
from _pytest.terminal import TerminalReporter, format_session_duration
from termcolor import colored

__version__ = "0.9.6"
Expand Down Expand Up @@ -523,7 +523,7 @@ def count(self, key: str, when: tuple = ("call",)) -> int:
def summary_stats(self) -> None:
session_duration = time.time() - self._sessionstarttime

print(f"\nResults ({round(session_duration, 2):.2f}s):")
print(f"\nResults ({format_session_duration(session_duration)}):")
justinmayer marked this conversation as resolved.
Show resolved Hide resolved
if self.count("passed") > 0:
self.write_line(
colored(" % 5d passed" % self.count("passed"), THEME.success)
Expand Down