-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfixture.py
More file actions
34 lines (23 loc) · 707 Bytes
/
fixture.py
File metadata and controls
34 lines (23 loc) · 707 Bytes
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
Fixture
@pytest.fixture()
def setup():
print("This will execute first")
yield
print("This will execute at last")
"""ABOVE FUNCTION PUT IN ANOTHER PAGE"""
def test_fixturedemo():
print("This will execute after setup")
def test_fixturedemo1():
print("This will execute after setup2")
def test_fixturedemo2():
print("This will execute after setup3")
FOR ABOVE CODE WE WILL GET OUTPUT: -
This will execute first
This will execute after setup
This will execute at last
IF WE CHANGE
def setup(scope = "class"):
print("This will execute first")
yield
print("This will execute at last")
#now at the beggining of test test setup will run and at last of the all test yield will run