Skip to content

Strange test name #151

@arut-grigoryan

Description

@arut-grigoryan

Python 3.6.8
pytest-6.1.2
cases-2.5.0

Test flask application

test_file

@pytest.fixture
def barToFoo():
    app.config["foo"]["bar"] = "foo"
    yield
    app.config["foo"]["bar"] = "bar"

@parametrize_with_cases("inputs,request_data", prefix="case_create_")
@pytest.mark.usefixtures("clearMongo", "mocked_oid", "mocked_uuid")
def test_create(db, flaskClient, inputs, request_data):
    ...

db, flaskClient, clearMongo, mocked_oid, mocked_uuid - fixtures

case file

class CreateCases(object):
    @case(id="simple")
    def case_create_2(self, barToFoo):
        inputs = ["foo", "bar"]
        request_data = {"foo": "dfg", "data": "asd"}
        return inputs, request_data

Test name is test_create[inputs_request_data_is_simple]. Without fixture barToFoo in params case_create_2, test name is test_create[simple].
How do i get the name test_create[simple] with fixture barToFoo?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions