File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,9 @@ def pytest_addoption(parser):
42
42
"--version" ,
43
43
"-V" ,
44
44
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." ,
46
48
)
47
49
group ._addoption (
48
50
"-h" ,
@@ -127,11 +129,11 @@ def showversion(config):
127
129
for line in plugininfo :
128
130
sys .stderr .write (line + "\n " )
129
131
else :
130
- sys .stderr .write ("pytest {}" .format (pytest .__version__ ))
132
+ sys .stderr .write ("pytest {}\n " .format (pytest .__version__ ))
131
133
132
134
133
135
def pytest_cmdline_main (config ):
134
- if config .option .version :
136
+ if config .option .version > 0 :
135
137
showversion (config )
136
138
return 0
137
139
elif config .option .help :
Original file line number Diff line number Diff line change @@ -1240,9 +1240,7 @@ def pytest_addoption(parser):
1240
1240
assert result .ret == ExitCode .USAGE_ERROR
1241
1241
1242
1242
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__ )])
1246
1244
assert result .ret == ExitCode .USAGE_ERROR
1247
1245
1248
1246
You can’t perform that action at this time.
0 commit comments