@given("employees informations are added", target_fixture="information_db")
def ensure_employees_informations_added():
return [_get_employee_information()]
我的问题是返回的列表会保存在 "information_db" 中吗?(我是使用 pytest 的新手)
@given("employees informations are added", target_fixture="information_db")
def ensure_employees_informations_added():
return [_get_employee_information()]
我的问题是返回的列表会保存在 "information_db" 中吗?(我是使用 pytest 的新手)
看起来您正在使用pytest-bdd
除了裸 pytest 之外的插件。
该插件的文档可以在https://github.com/pytest-dev/pytest-bdd找到
长话短说,是的。返回的列表将保存在information_db
名称下。
下一个子句可以通过将目标夹具的名称放入函数参数列表中来访问它:
@given("check employee")
def check_employee(information_db):
assert information_db[0]['skill'] == 42