ScopeMismatch for using a session fixture with the pytest-mozwebqa plugin for py.test

I am using a plugin pytest-mozwebqa

to run some selenium tests. I only want to log into the application once for all tests, so I tried using a session bound instrument in conftest.py

, but I get the following error. How can I write this login application so that login is not required for every test and one login is available for all tests?

This is the error I am getting:

================================================================================================= ERRORS ==================================================================================================
___________________________________________________________________________ ERROR at setup of TestData.test_selected_version ____________________________________________________________________________
ScopeMismatch: You tried to access the 'function' scoped fixture 'mozwebqa' with a 'module' scoped request object, involved factories
conftest.py:6:  def login(mozwebqa, variables)
../../.virtualenvs/webqa/lib/python2.7/site-packages/pytest_mozwebqa/pytest_mozwebqa.py:159:  def pytest_funcarg__mozwebqa(request)

      

Content conftest.py

:

@pytest.fixture(scope='session')
def login(mozwebqa, variables):
    data_page = DataPage(mozwebqa)
    network_page = data_page.select_version(variables)
    return network_page

      

+3


source to share


1 answer


you need to make the scope of the login function the same as mozwebqa fixture



0


source







All Articles