当我使用像mocha / jasmine这样的工具时,我可以创建一组由上下文聚合的测试。 (使用describe关键字)
在我创建测试集/聚合后,我在运行结果中看到它,我只能运行一组测试。
我如何用pytest实现这个目标?
答案 0 :(得分:1)
您可以使用与标记(或茉莉花中的grep)类似的标记对测试进行分组
import pytest
@pytest.mark.webtest
def test_send_http():
pass # perform some webtest test for your app
def test_something_quick():
pass
def test_another():
pass
class TestClass:
def test_method(self):
pass
并使用pytest -v -m webtest
其他选项是按类分组 - 一个套件是一个类,并使用pytest
运行此类