Skip to content

New hook to customize @pytest.mark.parametrize test ids #930

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

Closed
nicoddemus opened this issue Aug 8, 2015 · 1 comment
Closed

New hook to customize @pytest.mark.parametrize test ids #930

nicoddemus opened this issue Aug 8, 2015 · 1 comment
Labels
topic: parametrize related to @pytest.mark.parametrize type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature
Milestone

Comments

@nicoddemus
Copy link
Member

Currently @pytest.mark.parametrize can customize the generated ids for its parameters by passing a list of strings or a function.

It would be nice for plugins to be able to customize those ids for some specific types (#923), or even supplied by the user on a conftest file to generate readable parameter ids even for project-specific objects.

I propose to add a new hook along the lines of:

def pytest_make_parametrize_id(config, val):
    """Return a user-friendly string representation of the given ``val`` that will be used 
    by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``.
    """
@nicoddemus nicoddemus added the type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature label Aug 8, 2015
@pfctdayelise pfctdayelise added the topic: parametrize related to @pytest.mark.parametrize label Aug 11, 2015
@RonnyPfannschmidt RonnyPfannschmidt added this to the 3.0 milestone Sep 13, 2015
@RonnyPfannschmidt
Copy link
Member

closing since #1535 is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: parametrize related to @pytest.mark.parametrize type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature
Projects
None yet
Development

No branches or pull requests

3 participants