blob: 4676509d79e7eb08e9062a28b6f0abf799556f3f (
plain)
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
|
import pytest
@pytest.fixture
def my_fixture():
print('my_fixture')
def test_foo(my_fixture):
print('runing test')
@pytest.fixture
def fix1():
print('fix1')
yield
# Cleanup
print('Good bye: fix1')
def test_fix1(fix1):
print('Running test_fix1')
@pytest.fixture
def fix2(my_fixture):
yield
# Cleanup
print('Good bye: fix2')
def test_fix2(fix2):
print('Running test_fix2')
@pytest.fixture
def some_data(my_fixture):
print('some_data fixture')
yield {'a': 1, 'b': 2}
# Cleanup
print('Good bye: fix2')
def test_some_data(some_data):
print(some_data)
print('Running test_fix2')
@pytest.mark.usefixtures('fix1', 'fix2')
def test_foo():
print('Running test_foo')
|