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

My question is will the returned list be saved in "information_db" ? (I am new with working with pytest )

1 Answers1

0

Looks like you are using pytest-bdd plugin in additional to bare pytest.

The plugin's documentation can be found at https://github.com/pytest-dev/pytest-bdd

Long story short, yes. The returned list will be saved under information_db name.

The next clause can access it by putting the target fixture's name into a list of the function's arguments:

@given("check employee")
def check_employee(information_db): 
    assert information_db[0]['skill'] == 42
Andrew Svetlov
  • 16,730
  • 8
  • 66
  • 69