跳转到主要内容

使用🤢/🤮显示你不喜欢的测试,标记为yuk的测试用例。

项目描述

pytest-yuk

pytest插件,允许您使用🤢表示通过,🤮表示失败来可视化您不喜欢的测试。

安装

$ pip install pytest-yuk

用法

使用@pytest.mark.yuk标记测试

import pytest

@pytest.mark.yuk
def test_pass():
    assert 1 == 1

@pytest.mark.yuk
def test_fail():
    assert 1 == 2

def test_pass_unmarked():
    assert 1 == 1

def test_fail_unmarked():
    assert 1 == 2

然后使用--yuk运行

$ pytest --yuk --tb=no test_yuk.py   
========================= test session starts ==========================
collected 4 items                                                      

test_yuk.py 🤢🤮.F                                               [100%]

===================== 2 failed, 2 passed in 0.02s ======================

--yuk -v

$ pytest --yuk -v --tb=no test_yuk.py
========================= test session starts ==========================
collected 4 items                                                      

test_yuk.py::test_pass PASSED 🤢                                 [ 25%]
test_yuk.py::test_fail FAILED 🤮                                 [ 50%]
test_yuk.py::test_pass_unmarked PASSED                           [ 75%]
test_yuk.py::test_fail_unmarked FAILED                           [100%]

===================== 2 failed, 2 passed in 0.02s ======================

没有--yuk标志不会更改输出

$ pytest --tb=no test_yuk.py   
========================= test session starts ==========================
collected 4 items                                                      

test_yuk.py .F.F                                                 [100%]

===================== 2 failed, 2 passed in 0.02s ======================

类似项目

此插件受到了以下其他优秀插件的启发

来自okken的其他pytest插件

  • pytest-check:允许每个测试有多个失败。
  • pytest-srcpaths:一个插件,通过将指定的路径添加到sys.path来帮助pytest找到您想要测试的代码。

项目详情


下载文件

为您的平台下载文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

pytest-yuk-0.0.1.post2.tar.gz (4.2 kB 查看哈希值)

上传时间:

构建分布

pytest_yuk-0.0.1.post2-py2.py3-none-any.whl (3.3 kB 查看哈希值)

上传时间: Python 2 Python 3

由以下支持