【pytest】跳过之函数内部skip

建议使用场景:setup执行失败,但是后续用例不想被当作执行失败(error)识别时

# !/usr/bin/python3
# -*- coding:utf-8 -*-
import pytest


class TestCreateMoments:
    def setup_class(self):
        pytest.skip('skip')
        print('setup')

    def test_1t(self):
        print(1)

    def test_2(self):
        print(2)

    def teardown_class(self):
        print('teardown')

#自动化测试#
python自动化 文章被收录于专栏

python写好pytest自动化的一些小妙招

全部评论

相关推荐

饿魔:看到在线简历了吧
点赞 评论 收藏
分享
淬月星辉:专利是什么?至少描述一下吧,然后把什么计算机二级、普通话这种拉低格调的证书删掉,不然hr以为你没东西写
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务