-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_setup_teardown.py
63 lines (36 loc) · 1.04 KB
/
test_setup_teardown.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import pytest
def setup():
print('setup --------')
def teardown():
print('teardown --------')
def setup_module():
print('setup: 每个模块前执行')
def teardown_module():
print('teardown: 每个模块后执行')
def setup_function():
print('setup: 每个函数前执行')
def teardown_function():
print('teardown: 每个函数后执行')
def test_four():
print('test-four')
def test_five():
print('test-five')
class TestClass:
def setup(self):
print('setup ========')
def teardown(self):
print('teardown ========')
def setup_class(self):
print('setup: 每个类开始执行')
def teardown_class(self):
print('teardown: 每个类结束执行')
def setup_method(self):
print("setup: 每个用例开始执行")
def teardown_method(self):
print('teardown:每个用例结束执行')
def test_one(self):
print('test-one')
def test_two(self):
print('test-two')
def test_three(self):
print('test-three')