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

fix #13031: use the concrete id NOTSET for the empty parameter list #13073

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RonnyPfannschmidt
Copy link
Member

this ensures we dont invoke idfunc with the internal NOTSET enum token

closes #13031

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Dec 17, 2024
…ter list stand-in

this ensures we dont invoke idfunc with the internal NOTSET enum token
@RonnyPfannschmidt RonnyPfannschmidt force-pushed the ronny/fix-13031-parametrize-empty-concrete-id branch from c87c874 to da7251c Compare December 18, 2024 12:56
@@ -0,0 +1,2 @@
``pytest.mark.parametrize([], isfunc=...)`` will no longer call the idfunc with the internal ``NOTSET``
Copy link
Member

@nicoddemus nicoddemus Dec 18, 2024

Choose a reason for hiding this comment

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

isfunc? Is that correct?

Also can you rewrite this from the POV of an user? I mean the description by itself is hard to understand without reading the associated issue first.

src/_pytest/mark/structures.py Show resolved Hide resolved
import pytest

def idfunc(value):
raise ValueError()
Copy link
Member

Choose a reason for hiding this comment

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

IIUC idfunc is no longer being called when parametrize receives an empty list, is that 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.

correct , the exception here is to ensure its never getting triggered

Comment on lines +1058 to +1059
def idfunc(value):
raise ValueError()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def idfunc(value):
raise ValueError()
def idfunc(value):
raise ValueError()

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.

Parametrizing a test with an empty list calls ids callback with the private constant NOTSET
2 participants