目标固定装置是用来做什么的?

3
@given("employees informations are added", target_fixture="information_db")
def ensure_employees_informations_added(): 
    return [_get_employee_information()]

我的问题是返回的列表会保存在“information_db”中吗?(我是pytest的新手)
1个回答

0

看起来你正在使用除了裸的 pytest 外的 pytest-bdd 插件。

插件的文档可以在 https://github.com/pytest-dev/pytest-bdd 找到。

长话短说,是的。返回的列表将保存在 information_db 的名称下。

下一个从句可以通过将目标 fixture 的名称放入函数参数列表中来访问它:

@given("check employee")
def check_employee(information_db): 
    assert information_db[0]['skill'] == 42

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接