Skip to content
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

argparsing: support parser.addini(type="paths") which returns pathlib.Paths #8594

Merged
merged 1 commit into from
May 7, 2021

Conversation

bluetech
Copy link
Member

Part of issue #7259, specifically #7259 (comment).

@@ -1427,6 +1427,12 @@ def _getini(self, name: str):
dp = self.inipath.parent
input_values = shlex.split(value) if isinstance(value, str) else value
return [legacy_path(str(dp / x)) for x in input_values]
elif type == "paths":
# TODO: This assert is probably not valid in all cases.
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: this is copy/paste from branch above

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

i was just wondering, how will we migrate from py.path lists to pathlib lists, new names ? what do we do if "both" are there

@bluetech
Copy link
Member Author

I was just wondering, how will we migrate from py.path lists to pathlib lists, new names ? what do we do if "both" are there

As far as I can see, pytest itself does not have pathlist options.

For plugins, I think they can just change from pathlist to paths - why would new names be needed?

@RonnyPfannschmidt
Copy link
Member

Perhaps im overly pedantic over Integration, this might break plugins that reach into the options of other plugins

@bluetech
Copy link
Member Author

Perhaps im overly pedantic over Integration, this might break plugins that reach into the options of other plugins

I don't think there is much we can do about that


The value of ini-variables can be retrieved via a call to
:py:func:`config.getini(name) <_pytest.config.Config.getini>`.
"""
assert type in (None, "string", "pathlist", "args", "linelist", "bool")
assert type in (None, "string", "paths", "pathlist", "args", "linelist", "bool")
Copy link
Member

Choose a reason for hiding this comment

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

lets put in a DeprecationWarning while at it

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should handle all of the py.path deprecations as one, otherwise we will need at least a dozen different warning types which would be a mess for the users.

Copy link
Member

Choose a reason for hiding this comment

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

we need different warnings for different cases, so im thinking its a little better to add them while we integrate that

plus it gives everyone the opportunity to start their own porting/support for the new apis as soon as they are available (instead of later) (all the things going to warn at once seems daunting to me personally)

Copy link
Member Author

Choose a reason for hiding this comment

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

we need different warnings for different cases, so im thinking its a little better to add them while we integrate that

I was thinking we collect them all together in one place https://docs.pytest.org/en/stable/deprecations.html.

plus it gives everyone the opportunity to start their own porting/support for the new apis as soon as they are available (instead of later) (all the things going to warn at once seems daunting to me personally)

Interesting, to me it's the exact opposite - I'd rather be able to do all the work at once, at a definite version point (especially as a plugin), then to do it in drips across multiple versions.

Copy link
Member

Choose a reason for hiding this comment

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

@bluetech makes me think i want to start a extra addon to enable determining when a warning should start to appear (so we can coordinate warning start and feature end more detailed, but thats for later, we can decide on the exact mechanism later

but yeah, the perspectives are indeed different, i prefer steady small changes over all at once changes,
but i also see the drag that can be triggered by having changes belonging to a larger scheme tickle in

im happy to leave the particular warnings out and defer the warning topic for later

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, thanks.

I'll try to work on the coordinated py.path deprecation today or tomorrow. We still have the reportinfo headache, but I'm think just deferring that specific one is OK.

Copy link
Member

Choose a reason for hiding this comment

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

I missed this review completely, but wanted to comment on this:

Interesting, to me it's the exact opposite - I'd rather be able to do all the work at once, at a definite version point (especially as a plugin), then to do it in drips across multiple versions.

Same for me, it would be much more annoying to have to deal with warnings for the same issues across multiple versions than just sitting down and fixing it once.

@bluetech bluetech merged commit 886fd70 into pytest-dev:main May 7, 2021
@bluetech bluetech deleted the addini-paths branch May 17, 2021 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants