Closed fenekku closed 5 years ago
Hello,
pytest 3.8.1 fixed some scoping issues, but this caused
def pytest_generate_tests(metafunc): # ... metafunc.parametrize('browser', browsers, indirect=True)
to generate a session scoped parametrized test. The following hook
@pytest.hookimpl(tryfirst=True, hookwrapper=True) def pytest_runtest_makereport(item, call):
was then just run once the session was torndown (or at least not at the right moment).
def _take_screenshot_if_test_failed(browser, request): ...
would throw AttributeError: 'Session' object has no attribute 'rep_call' because item was never set the rep.
AttributeError: 'Session' object has no attribute 'rep_call'
item
rep
Long story short, metafunc.parametrize('browser', browsers, indirect=True, scope='function') fixes it.
metafunc.parametrize('browser', browsers, indirect=True, scope='function')
Side note, the test suite is broken for Elasticsearch 6.
LGTM! Thank you for your contribution!
Actually, could you please remove the version change in your commit? We are going to release it just after merging the other PR that is open.
version
Done! :+1:
Hello,
pytest 3.8.1 fixed some scoping issues, but this caused
to generate a session scoped parametrized test. The following hook
was then just run once the session was torndown (or at least not at the right moment).
would throw
AttributeError: 'Session' object has no attribute 'rep_call'
becauseitem
was never set therep
.Long story short,
metafunc.parametrize('browser', browsers, indirect=True, scope='function')
fixes it.Side note, the test suite is broken for Elasticsearch 6.