【发布时间】:2022-06-13 20:44:18
【问题描述】:
我以以下方式构建了我的 pytest 类:
class Test_Exit_Code(object):
def setup_class(cls):
If 2==2:
# stop execution of the test class
def test_a(self):
assert True==True
正如您在 setup_class 方法中看到的那样,我插入了一个 IF ,我想在 if 部分中实现的是,如果某个条件似乎为真,而不是我想返回退出代码 5 的注释,即没有收集任何测试。 到目前为止,我还没有找到任何方法。
【问题讨论】:
-
我不认为你可以这样做:当
setup_class运行时,pytest已经完成了收集阶段。
标签: python-3.x pytest exit-code