Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScopeMismatch on using session scoped fixture with pytest-mozwebqa plugin for py.test

Tags:

I am using pytest-mozwebqa plugin for running some selenium tests. I want to login to the application only once for all the tests so I tried using a session scoped fixture in the conftest.py but I am getting following error. How can I write this login fixture so that login is not required per test and a single login is available to 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 of the conftest.py:

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