Skip to content

Parametrized test fails with fixture named "request" #611

@pytestbot

Description

@pytestbot

Originally reported by: Veeti Paananen (BitBucket: veeti, GitHub: veeti)


import pytest

@pytest.fixture
def request():
    return 123

@pytest.mark.parametrize('param', [1, 2, 3])
def test_stuff(request, param):
    # test stuff
    assert True

Fails with:

    def get_direct_param_fixture_func(request):
>       return request.param
E       AttributeError: 'int' object has no attribute 'param'

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: parametrizerelated to @pytest.mark.parametrizetype: backward compatibilitymight present some backward compatibility issues which should be carefully noted in the changelogtype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions