Skip to content Skip to sidebar Skip to footer

Pytest Attributeerror When Using Fixture With Yield

I am using pytest fixture with yield. But receive AttributeError when trying to get value that yield returns conftest.py @pytest.fixture() def driver_setup(): driver = webdrive

Solution 1:

You need to update driver_setup fixture as below if you want access to driver in tests.

@pytest.fixture()defdriver_setup(request):
    driver = webdriver
    request.cls.driver = driver
    yield
    driver.quit()

For more details refer to http://computableverse.com/blog/pytest-sharing-class-fixtures.

Post a Comment for "Pytest Attributeerror When Using Fixture With Yield"