Skip to content

when @parametrize finds a fixture_ref in its argvalues, the parameter is not anymore accessible through request.getfixturevalue #146

@TheCaffinatedDeveloper

Description

@TheCaffinatedDeveloper

Hi again @smarie!

Trying to figure out how to maintain the return values from cases that use a fixture as their own fixture name.

Example

conftest.py

@pytest.fixture
def some_fixture():
       return 1

@pytest.fixture(scope='function', autouse=True)
def some_other_fixture(request):
       # ouput will contain test_some_test_important_value_other_important_value as the fixture name
       print('fixturenames: ' + str(request.node.fixturenames))
       # hoping for important_value and other_important_value to be listed as fixtures

def case_some_case(some_fixture):
      important_value = some_fixture
      other_important_value = 2
      return important_value, other_important_value

mock_test.py

@parametrize_with_cases("important_value, other_important_value", cases='.')
def test_some_test(important_value, other_important_value):
       # important_value and other_important_value are here no problem
       assert important_value == 1
       assert other_important_value == 2

expected: [request, ..., ..., important_value, other_important_value, ...]
actual: [request, ..., ..., test_some_test_important_value_other_important_value, ...]

Note: this only happens when I use a fixture on the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions