如何在pytest中将变量从测试函数传递给fixture?

时间:2017-11-15 16:35:06

标签: pytest

以下是来自contest.py的示例代码

@pytest.fixture
def required_input(var1): # not sure if i can pass var1 to the fixture.
    return var1+"_test"
下面的

是test_code.py

的测试用例
def test_case1(required_input):
    x = required_input("tt")  # Not sure if it can be called like this.
    assert 'tt_test' == x

如何将变量从我的测试函数传递到灯具?

1 个答案:

答案 0 :(得分:0)

灯具可以是一个功能:

spring.jpa.properties.hibernate.dialect: org.hibernate.dialect.MySQL5InnoDBDialect