Skip to content

Commit

Permalink
Update the line separator during test results
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmintz committed Sep 22, 2024
1 parent 25a7dbb commit 55f2a8d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nose/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
provide support for error classes (such as the builtin skip and deprecated
classes), and hooks for plugins to take over or extend reporting."""
import logging
import os
from contextlib import suppress
from unittest import TextTestResult as _TextTestResult
from nose.config import Config
from nose.util import isclass, ln as _ln
Expand Down Expand Up @@ -95,7 +97,15 @@ def printSummary(self, start, stop):
taken = float(stop - start)
run = self.testsRun
plural = run != 1 and "s" or ""
writeln(self.separator2)
terminal_width = 40 # The default width if failure to calculate
with suppress(Exception):
terminal_width = os.get_terminal_size().columns
if not isinstance(terminal_width, int):
terminal_width = 40
elif terminal_width < 26:
terminal_width = 26
separator = "-" * terminal_width
writeln(separator[:70])
writeln("Ran %s test%s in %.3fs" % (run, plural, taken))
writeln()
summary = {}
Expand Down

0 comments on commit 55f2a8d

Please sign in to comment.