如果我有pytest标记来标记需要特殊处理的测试。例如,如果它们太慢或需要特殊的硬件,特殊的操作系统等。
@pytest.mark.foo
def test_foo_1():
# ...
@pytest.mark.bar
def test_bar_1():
# ...
然后我可以通过pytest -m "not foo and not bar"
调用没有这些标记的测试。
现在,如果我有很多这样的标记,那么每次键入pytest -m 'not foo and not bar and not zebra and not ...'
可能会很烦人。
是否可以通过某种方式对所有这些特殊测试进行分组,以便可以通过python -m 'not special'
运行测试?除了向所有特殊测试中添加另一个标记special
。