Skip to content

Commit

Permalink
terminal: display explicit args also with -vv (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored Nov 1, 2019
1 parent 3978906 commit f16d1a4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/_pytest/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,11 @@ def pytest_report_header(self, config):
for desc, values in config._implicit_args
)
)
if config.option.verbose > 1 and config.invocation_params.args:
result.append(
"explicit args: %s"
% " ".join([shell_quote(str(x)) for x in config.invocation_params.args])
)

return result

Expand Down
16 changes: 13 additions & 3 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,8 +1457,18 @@ def test():
result.stdout.fnmatch_lines(
["implicit args: \"-k 'foo and bar'\" (addopts config), '-v' (PYTEST_ADDOPTS)"]
)
# Not displayed with verbosity < 2.
assert "explicit_args" not in result.stdout.str()

ini.remove()
monkeypatch.setenv("PYTEST_ADDOPTS", "-v -k 'bar'")
result = testdir.runpytest(str(p))
result.stdout.fnmatch_lines(["implicit args: '-v -k bar' (PYTEST_ADDOPTS)"])
monkeypatch.setenv("PYTEST_ADDOPTS", "-vv -k 'bar'")
result = testdir.runpytest("-v", "-m", "foo and bar", str(p))
result.stdout.fnmatch_lines(
[
"implicit args: '-vv -k bar' (PYTEST_ADDOPTS)",
"explicit args: -v -m 'foo and bar' *test_report_implicit_args.py --basetemp=*",
]
)
result = testdir.runpytest()
# Not displayed without any.
assert "explicit_args" not in result.stdout.str()

0 comments on commit f16d1a4

Please sign in to comment.