标签:correct 装饰器 wro 多个 自定义标签 src 技术 pre image
问题:
测试用例中添加了 @pytest.mark.login装饰器,如果不在pytest.ini中添加makers的话,就会报PytestUnknownMarkWarning: Unknown pytest.mark.login - is this a typo? You can register custom marks to avoid this warning
@pytest.mark.usefixtures(‘my_setup_class‘)
@pytest.mark.login
@pytest.mark.parametrize(‘data‘,login.user_incorrect)
def test_login_2_wrong(self,data,my_setup_class):
driver,login_page=my_setup_class
login_page.clear_phone()
login_page.clear_pwd()
login_page.submit_userinfo(data[‘phone‘],data[‘password‘])
assert (data[‘expected‘]==login_page.alert_info().text)
解决办法:
在项目下新建一个pytest.ini的配置文件,里面如下配置即可。markers=后面是标签名,如有多个,第二个开始要换行,且要缩进,不然还是会warning
标签:correct 装饰器 wro 多个 自定义标签 src 技术 pre image
原文地址:https://www.cnblogs.com/gurenqi0705/p/14053300.html