File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1+
2+ import pytest
3+ import pprint
4+ def pytest_generate_tests (metafunc ):
5+ if 'arg1' in metafunc .fixturenames :
6+ metafunc .parametrize ("arg1" , [ 'arg1v1' , 'arg1v2' ], scope = 'module' )
7+
8+ if 'arg2' in metafunc .fixturenames :
9+ metafunc .parametrize ("arg2" , [ 'arg2v1' , 'arg2v2' ], scope = 'function' )
10+
11+ @pytest .fixture (scope = 'session' )
12+ def checked_order ():
13+ order = []
14+
15+ yield order
16+ pprint .pprint (order )
17+ assert order == []
18+
19+
20+ @pytest .yield_fixture (scope = 'module' )
21+ def fix1 (request , arg1 , checked_order ):
22+ checked_order .append ((request .node .name , 'fix1' , arg1 ))
23+ yield 'fix1-' + arg1
24+
25+ @pytest .yield_fixture (scope = 'function' )
26+ def fix2 (request , fix1 , arg2 , checked_order ):
27+ checked_order .append ((request .node .name , 'fix2' , arg2 ))
28+ yield 'fix2-' + arg2 + fix1
29+
30+ def test_one (fix2 ):
31+ pass
32+
33+ def test_two (fix2 ):
34+ pass
Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ rsyncdirs = tox.ini pytest.py _pytest testing
192192python_files = test_*.py *_test.py testing/*/*.py
193193python_classes = Test Acceptance
194194python_functions = test
195- norecursedirs = .tox ja .hg cx_freeze_source
195+ norecursedirs = .tox ja .hg cx_freeze_source testing/example_scripts
196196xfail_strict =true
197197filterwarnings =
198198 error
You can’t perform that action at this time.
0 commit comments