Skip to content

Conversation

@bluetech
Copy link
Member

@bluetech bluetech commented Nov 4, 2025

Fixes #13409 by deprecating non-Collection argvalues as described in the issue. The deprecation is both in runtime and in type checking time (via the new @warning.deprecated decorator, though it's not enabled in mypy by default yet).

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Nov 4, 2025
@bluetech
Copy link
Member Author

bluetech commented Nov 4, 2025

TODO: Avoid showing the two overloads for Metafunc.parameterize in the API reference.

@bluetech
Copy link
Member Author

bluetech commented Nov 5, 2025

TODO: Avoid showing the two overloads for Metafunc.parameterize in the API reference.

Tried a few things (TYPE_CHECKING, if False, sphinx autodoc hooks) but couldn't make sphinx ignore the overloads (sphinx-doc/sphinx#10351). There's probably a way but I'm just going to remove the @deprecated from Metafunc.parametrize. It will still be on @pytest.mark.parametrize which is not autodoc'ed so no problem.

@bluetech bluetech force-pushed the deprecate-parametrize-iterators branch from 02e5363 to 7846fdd Compare November 5, 2025 14:38
@bluetech
Copy link
Member Author

bluetech commented Nov 5, 2025

  • Fixed @nicoddemus's review comments.
  • Removed @deprecated from Metafunc (see comment above).
  • Improved the runtime deprecation message, since the @pytest.mark.parametrize is not on the stack when metafunc.parametrize is called, the stacklevel is useless for it. So I added the nodeid to the message.

We intend to start using it.
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Awesome!

I understand you don't want to ship this into 9.0?

@bluetech bluetech force-pushed the deprecate-parametrize-iterators branch from 7846fdd to dd47a89 Compare November 5, 2025 15:03
@bluetech
Copy link
Member Author

bluetech commented Nov 5, 2025

I understand you don't want to ship this into 9.0?

Gotta know where to stop :) This can go in the next release.

@nicoddemus
Copy link
Member

Fair enough. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate iterables which are not collections (e.g. generators) for tests parametrization

2 participants