@@ -40,15 +40,18 @@ def assert_state_and_move(self, path, cfg_factory):
4040@pytest .mark .parametrize ("cfg_factory" , CFG_TYPES ) # not actual params
4141def stereo_cfg (path , cfg_factory , request ):
4242 """
43- A fixture with two parameters
43+ A fixture with two parameters.
44+
45+ As opposed to `stereo_cfg_2`, we use here two @parametrize decorators.
46+ We check that the execution order is correct.
4447 """
4548 assert isinstance (path , str )
4649 assert isinstance (cfg_factory , type )
4750 a .assert_state_and_move (path = path , cfg_factory = cfg_factory )
4851 return "hello"
4952
5053
51- def test_stereo (stereo_cfg ):
54+ def test_stereo_two_parametrizers (stereo_cfg ):
5255 """
5356 A test relying on a double-parametrized fixture.
5457 See https://github.com/pytest-dev/pytest/issues/3960
@@ -82,7 +85,11 @@ def _id(x):
8285@pytest .mark .parametrize ("cfg_factory,path" , product (CFG_TYPES , STEREO_PATHS ), ids = _id )
8386def stereo_cfg_2 (path , request , cfg_factory ):
8487 """
85- A fixture with two parameters
88+ A fixture with two parameters.
89+
90+ As opposed to `stereo_cfg_1`, the order of the parameter is precomputed beforehand in
91+ `product(CFG_TYPES, STEREO_PATHS)` and a single call to parametrize is made.
92+ We check that the execution order is the same.
8693 """
8794 assert isinstance (path , str )
8895 assert isinstance (cfg_factory , type )
@@ -92,7 +99,7 @@ def stereo_cfg_2(path, request, cfg_factory):
9299 yield "hello"
93100
94101
95- def test_stereo_2 (stereo_cfg_2 ):
102+ def test_stereo_one_global_parametrizer (stereo_cfg_2 ):
96103 pass
97104
98105
0 commit comments