zoukankan      html  css  js  c++  java
  • run类中方法级别的setup和teardown.py

    import pytest
    import requests
    class TestCase(object):
    def test_case_01(self):
    """再执行三"""
    assert 1

    def test_case_02(self):
    """再执行六"""
    assert {"title":"v2ex"} != {"title":"V2EX"}

    def test_case_03(self):
    """再执行九"""
    assert 1

    def setup_class(self):
    """先执行一setup_class 类级别的setup"""
    print("类级别的setup")

    def teardown_class(self):
    """再执行十一teardown_class 类级别的teardown"""
    print("类级别的teardown")

    def setup_method(self):
    """再执行二setup_method 类中方法级别的setup"""
    """再执行五setup_method 类中方法级别的setup"""
    """再执行八setup_method 类中方法级别的setup"""
    print("类中方法级别的setup")

    def teardown_method(self):
    """再执行四teardown_method 类中方法级别的teardown"""
    """再执行七teardown_method 类中方法级别的teardown"""
    """再执行十teardown_method 类中方法级别的teardown"""
    print("类中方法级别的teardown ")

    if __name__ == '__main__':
    pytest.main(["-s","run类中方法级别的setup和teardown.py"])
  • 相关阅读:
    51nod1278 相离的圆
    CodeForces
    SPOJ
    51nod 1040(欧拉函数)
    51nod1009 51nod1042(数位dp)
    51nod1264 线段相交
    51nod1050 循环数组最大子段和
    Spark SQL UDF示例
    Spark SQL官网阅读笔记
    Spark RDD
  • 原文地址:https://www.cnblogs.com/zhang-da/p/12219133.html
Copyright © 2011-2022 走看看