Skip to content

Replace internal config._origargs with invocation_params.args #5644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for testing / ensuring - can be removed, and/or improved (msg).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RonnyPfannschmidt / @nicoddemus
What about this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, that one seems ok to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, nothing fishy at first glance.

Copy link
Contributor Author

@blueyed blueyed Jul 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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