Ami*_*mit 7 python fixtures pytest
我正在使用pytest-mozwebqa插件运行一些硒测试.我想只为所有测试登录一次应用程序,所以我尝试使用会话范围的夹具conftest.py但是我收到了以下错误.如何编写此登录夹具,以便每次测试不需要登录,并且所有测试都可以使用单个登录?
这是我得到的错误:
================================================================================================= 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)
Run Code Online (Sandbox Code Playgroud)
内容conftest.py:
@pytest.fixture(scope='session')
def login(mozwebqa, variables):
data_page = DataPage(mozwebqa)
network_page = data_page.select_version(variables)
return network_page
Run Code Online (Sandbox Code Playgroud)
小智 4
您需要设置登录功能范围,与 mozwebqa 固定装置相同