解决PytestUnknownMarkWarning: Unknown pytest.mark.welcome - is this a typo? You can register custom marks to avoid this warning

在项目下新建一个pytest.ini的配置文件,里面如下配置即可。markers=后面是标签名,如有多个,第二个开始要换行,且要缩进,不然会报错

[pytest]
markers=welcome
    login

原文地址:https://www.cnblogs.com/my_captain/p/12704370.html

时间: 2024-08-30 14:31:07

解决PytestUnknownMarkWarning: Unknown pytest.mark.welcome - is this a typo? You can register custom marks to avoid this warning的相关文章

标签不生效的处理方法:PytestUnknownMarkWarning: Unknown pytest.mark.wallet - is this a typo?...

今天在写代码的过程中遇到了这样一个warning:PytestUnknownMarkWarning: Unknown pytest.mark.test - is this a typo? 处理办法: 参考文档:https://docs.pytest.org/en/latest/mark.html 单个标签的话: 在contest里面添加代码: def pytest_configure(config): config.addinivalue_line( "markers", "

解决drbd Unknown 问题:

解决drbd Unknown 问题: cs:StandAlone ro:Secondary/Unknown ds:UpToDate/DUnknown   r----- 方法一: 在选定的非主节点上执行 drbdadm secondary data drbdadm -- --discard-my-data connect mysql 主节点上执行 drbdadm connect data 如果以上方法不行: 重新初始化 drbdadm detach data ###dd if=/dev/zero

使用@pytest.mark.parametrize进行参数传递测试

摘自:https://blog.csdn.net/sunny_happy08/article/details/83658661 最近因工作需要用到@pytest.mark.parametrize()传多个参数,实现执行不同数据. 我的需求数据源是excel,excel的每一行都是一条测试用例,已实现读取测试用例和处理测试用例的逻辑.接下来就是将这些测试数据通过pytest.mark.parametrize()传入测试函数,循环执行这些测试数据,每次执行时都需要assert用例结果, 以便将测试结

pytest 用 @pytest.mark.usefixtures("fixtureName")或@pytest.fixture(scope="function", autouse=True)装饰,实现类似setup和TearDown的功能

conftest.py import pytest @pytest.fixture(scope="class") def class_auto(): print("") print("class-begin") yield print("class-end") test_autouse.py 1 import pytest 2 3 4 @pytest.mark.usefixtures("class_auto"

pytest.mark.parametrize()参数化的应用一

1 from page.LoginPage import Loginpage 2 import os, sys, pytest 3 4 base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 5 sys.path.append(base_dir) 6 7 8 class TestLogin(): 9 10 @pytest.mark.parametrize( 11 "name, password", 1

解决[Xcodeproj] Unknown object version错误

错误描述: RuntimeError - [Xcodeproj] Unknown object version. /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.23.1/lib/xcodeproj/project.rb:206:in `initialize_from_file' /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.23.1/lib/xcodeproj/project.rb:91:in `open' /Libra

YII2安装中遇到的错误解决Calling unknown method: yii\web\UrlManager::addRules()

安装好YII2 后出现 如下图错误提示: 解决方法如下: 打开安装好的YII2项目目录(YII2安装方法参见 摘取天上星 的博文:http://blog.csdn.net/zqtsx/article/details/39344913) 打开YII2项目目录里的 composer.json 文件 (如下图) 在composer.json 文件里添加 如下(extra括号里的部分)代码: 修改后的composer.json文件 大致如下(extra部分为我们添加的新增代码): { "name&quo

Pytest编写测试函数

Pytest编写测试函数 一个规范的测试方法一定带有断言,在使用pytest时,可以直接使用Python自带的assert关键字 Pytest允许在assert关键字添加任意表达式,表达式的值通过bool转换后等于False则表示断言失败,测试用例执行失败:如果等于True则表示断言成功,测试用例执行成功. 重写assertpytest 可以重写assert关键字,它可以截断对原生assert的调用,替换为pytest定义的assert,从而展示更详细的信息和细节. from collectio

pytest 13 使用自定义标记mark

前言: pytest可以规定那些要跑,那些不跑,跑特定的哪些?比如以下的这个例子: #!/usr/bin/env/python # -*-coding:utf-8-*- import pytest @pytest.mark.runtest def test_run(): print("run") def test_not_run(): pass def test_not_run1(): pass class TestClass: def test_method(self): pass