使用🤢/🤮显示你不喜欢的测试,标记为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找到您想要测试的代码。