Skip to content

Commit 87ce586

Browse files
authored
Merge pull request #5055 from blueyed/showhelp-lazy-fullwidth
showhelp: move tw.fullwidth out of the loop
2 parents 4f33f46 + e20b39d commit 87ce586

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/_pytest/helpconfig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,14 @@ def showhelp(config):
151151
)
152152
tw.line()
153153

154+
columns = tw.fullwidth # costly call
154155
for name in config._parser._ininames:
155156
help, type, default = config._parser._inidict[name]
156157
if type is None:
157158
type = "string"
158159
spec = "%s (%s)" % (name, type)
159160
line = " %-24s %s" % (spec, help)
160-
tw.line(line[: tw.fullwidth])
161+
tw.line(line[:columns])
161162

162163
tw.line()
163164
tw.line("environment variables:")

0 commit comments

Comments
 (0)