Skip to content

Commit 2de0c6c

Browse files
tsvikasionelmc
authored andcommitted
add reference to code source
1 parent 362a359 commit 2de0c6c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/pytest_cov/engine.py

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def get_node_desc(platform, version_info):
136136

137137
@staticmethod
138138
def get_width():
139+
# taken from https://github.com/pytest-dev/pytest/blob/33c7b05a/src/_pytest/_io/terminalwriter.py#L26
139140
width, _ = shutil.get_terminal_size(fallback=(80, 24))
140141
# The Windows get_terminal_size may be bogus, let's sanify a bit.
141142
if width < 40:
@@ -147,6 +148,7 @@ def sep(self, stream, s, txt):
147148
stream.sep(s, txt)
148149
else:
149150
fullwidth = self.get_width()
151+
# taken from https://github.com/pytest-dev/pytest/blob/33c7b05a/src/_pytest/_io/terminalwriter.py#L126
150152
# The goal is to have the line be as long as possible
151153
# under the condition that len(line) <= fullwidth.
152154
if sys.platform == 'win32':
@@ -163,6 +165,7 @@ def sep(self, stream, s, txt):
163165
# trailing space is not important at the end of the line.
164166
if len(line) + len(s.rstrip()) <= fullwidth:
165167
line += s.rstrip()
168+
# (end of terminalwriter borrowed code)
166169
line += '\n\n'
167170
stream.write(line)
168171

0 commit comments

Comments
 (0)