How to get return / yield value of pytest dependency

264 Views Asked by At

I am using pytest-dependency to create dependency on tests. I want the dependent test to get return value from another test.

Example:

@pytest.mark.dependency()
def test_owner_create_book(app):
  response = app.post(...) 
  return response["data"]["id"]

@pytest.mark.dependency(depends=["test_owner_create_book"])
def test_owner_read_book(app):
  # I want to get the id from previous response here

How can I get the response from dependency?

Packages in use:

pytest = "^6.1.1"
pytest-dependency = "^0.5.1"
0

There are 0 best solutions below