4
4
# License: 3-clause BSD, <https://github.com/smarie/python-pytest-cases/blob/master/LICENSE>
5
5
import pytest
6
6
7
- from pytest_cases import parametrize_plus , pytest_fixture_plus , fixture_ref
7
+ from pytest_cases import parametrize , pytest_fixture_plus , fixture_ref
8
8
9
9
10
10
@pytest .fixture
@@ -18,23 +18,40 @@ def b(arg):
18
18
return "B%s" % arg
19
19
20
20
21
- @parametrize_plus ("arg1,arg2" , [('1' , None ),
22
- (None , '2' ),
23
- fixture_ref ('a' ),
24
- ('4' , '4' ),
25
- ('3' , fixture_ref ('b' ))
26
- ])
21
+ argvalues = [
22
+ ('1' , None ),
23
+ (None , '2' ),
24
+ fixture_ref ('a' ),
25
+ fixture_ref ('a' , id = "aaa" ),
26
+ ('4' , '4' ),
27
+ ('1' , fixture_ref ('a' )),
28
+ ('3' , fixture_ref ('b' ))
29
+ ]
30
+
31
+
32
+ @parametrize ("arg1,arg2" , argvalues )
27
33
def test_foo (arg1 , arg2 ):
28
34
print (arg1 , arg2 )
29
35
30
36
37
+ @parametrize ("arg1,arg2" , argvalues , idstyle = 'compact' )
38
+ def test_foo_compact (arg1 , arg2 ):
39
+ print (arg1 , arg2 )
40
+
41
+
42
+ @parametrize ("arg1,arg2" , argvalues , idstyle = None )
43
+ def test_foo_nostyle (arg1 , arg2 ):
44
+ print (arg1 , arg2 )
45
+
46
+
31
47
def test_synthesis (module_results_dct ):
32
48
"""See https://github.com/smarie/python-pytest-cases/issues/86"""
33
49
assert list (module_results_dct ) == [
34
50
'test_foo[arg1_arg2_is_P0toP1-1-None]' ,
35
51
'test_foo[arg1_arg2_is_P0toP1-None-2]' ,
36
52
'test_foo[arg1_arg2_is_a]' ,
53
+ 'test_foo[arg1_arg2_is_aaa]' ,
37
54
'test_foo[arg1_arg2_is_4-4]' ,
38
- 'test_foo[arg1_arg2_is_P4 -1]' ,
39
- 'test_foo[arg1_arg2_is_P4 -2]'
55
+ 'test_foo[arg1_arg2_is_P5 -1]' ,
56
+ 'test_foo[arg1_arg2_is_P5 -2]'
40
57
]
0 commit comments