Skip to content

Commit

Permalink
Replace internal config._origargs with invocation_params.args
Browse files Browse the repository at this point in the history
Added in pytest-dev#5564.
  • Loading branch information
blueyed committed Jul 23, 2019
1 parent c05fcc8 commit 3c74389
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,10 @@ class Config:
Object containing the parameters regarding the ``pytest.main``
invocation.
Contains the followinig read-only attributes:
Contains the following read-only attributes:
* ``args``: list of command-line arguments as passed to ``pytest.main()``.
* ``plugins``: list of extra plugins, might be None
* ``plugins``: list of extra plugins, might be None.
* ``dir``: directory where ``pytest.main()`` was invoked from.
"""

Expand Down Expand Up @@ -915,7 +915,7 @@ def parse(self, args, addopts=True):
assert not hasattr(
self, "args"
), "can only parse cmdline args at most once per Config object"
self._origargs = args
assert self.invocation_params.args == args
self.hook.pytest_addhooks.call_historic(
kwargs=dict(pluginmanager=self.pluginmanager)
)
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/helpconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def pytest_cmdline_parse():
py.__version__,
".".join(map(str, sys.version_info)),
os.getcwd(),
config._origargs,
config.invocation_params.args,
)
)
config.trace.root.setwriter(debugfile.write)
Expand Down
4 changes: 2 additions & 2 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def test_basic_behavior(self, _sys_snapshot):
assert config.option.capture == "no"
assert config.args == args

def test_origargs(self, _sys_snapshot):
def test_invocation_params_args(self, _sys_snapshot):
"""Show that fromdictargs can handle args in their "orig" format"""
from _pytest.config import Config

Expand All @@ -450,7 +450,7 @@ def test_origargs(self, _sys_snapshot):

config = Config.fromdictargs(option_dict, args)
assert config.args == ["a", "b"]
assert config._origargs == args
assert config.invocation_params.args == args
assert config.option.verbose == 4
assert config.option.capture == "no"

Expand Down

0 comments on commit 3c74389

Please sign in to comment.