Skip to content

Commit 1270105

Browse files
committed
fixed failing test in test_config.py
1 parent 5349470 commit 1270105

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/_pytest/helpconfig.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def pytest_addoption(parser):
4242
"--version",
4343
"-V",
4444
action="count",
45-
help="display pytest version and information about plugins.",
45+
default=0,
46+
help="display pytest version and information about plugins."
47+
"When given twice, also display information about plugins.",
4648
)
4749
group._addoption(
4850
"-h",
@@ -127,11 +129,11 @@ def showversion(config):
127129
for line in plugininfo:
128130
sys.stderr.write(line + "\n")
129131
else:
130-
sys.stderr.write("pytest {}".format(pytest.__version__))
132+
sys.stderr.write("pytest {}\n".format(pytest.__version__))
131133

132134

133135
def pytest_cmdline_main(config):
134-
if config.option.version:
136+
if config.option.version > 0:
135137
showversion(config)
136138
return 0
137139
elif config.option.help:

testing/test_config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,9 +1240,7 @@ def pytest_addoption(parser):
12401240
assert result.ret == ExitCode.USAGE_ERROR
12411241

12421242
result = testdir.runpytest("--version")
1243-
result.stderr.fnmatch_lines(
1244-
["*pytest*{}*imported from*".format(pytest.__version__)]
1245-
)
1243+
result.stderr.fnmatch_lines(["pytest {}".format(pytest.__version__)])
12461244
assert result.ret == ExitCode.USAGE_ERROR
12471245

12481246

0 commit comments

Comments
 (0)