伪代码:
def setup_module:整个.py模块仅允许一次
def teardown_module:整个.py模块仅允许一次
def setup_function:每个用例开始前执行
def teardown_function:每个用例结束后执行
def test_1()
def test_2()
class:
setup_class:所有用例执行之前
teardown_class:所有用例执行之后
setup:每个用例开始前执行
teardown:每个用例结束后执行
setup_method:每个用例开始前执行<br /> teardown_method:每个用例结束后执行<br /> <br /> def test_3()<br /> def test_4()
执行顺序:
setup_module
setup_function
【test_1】
teardown_function
setup_function<br /> 【test_2】<br /> teardown_functionsetup_class<br /> setup_method<br /> setup<br /> 【test-3】<br /> teardown<br /> teardown_methodsetup_method<br /> setup<br /> 【test-4】<br /> teardown<br /> teardown_method<br /> teardown_class
teardown_module
