Skip to content

Commit 627cd25

Browse files
author
Sylvain MARIE
committed
Improved tests
1 parent c2b6089 commit 627cd25

File tree

2 files changed

+44
-15
lines changed

2 files changed

+44
-15
lines changed

pytest_cases/tests/cases/issues/test_issue_126_2.py

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TestA:
2121
def a_nested(self):
2222
return 2
2323

24-
def test_a(self, a):
24+
def test_a_nested(self, a):
2525
assert a == 2
2626

2727
@parametrize_with_cases('o', debug=True)
@@ -48,18 +48,32 @@ def test_foo2(o):
4848

4949
def test_synthesis(module_results_dct):
5050
assert list(module_results_dct) == [
51-
'test_a',
52-
'test_foo_nested[o_is_a_]',
53-
'test_foo_nested[o_is_b_-a=*]',
54-
'test_foo_nested[o_is_b_-a=**]',
55-
'test_foo_nested2[o_is_a_]', # <- note that case fixture names are the same: correctly reused
56-
'test_foo_nested2[o_is_b_-a=*]',
57-
'test_foo_nested2[o_is_b_-a=**]',
58-
'test_bar',
59-
'test_foo[o_is_a_]',
60-
'test_foo[o_is_b_-a=*]',
61-
'test_foo[o_is_b_-a=**]',
62-
'test_foo2[o_is_a_]', # <- note that case fixture names are the same: correctly reused
63-
'test_foo2[o_is_b_-a=*]',
64-
'test_foo2[o_is_b_-a=**]'
51+
# all tests in TestA class
52+
'test_a_nested',
53+
'test_foo_nested[o_is_a_]',
54+
'test_foo_nested[o_is_b_-a=*]',
55+
'test_foo_nested[o_is_b_-a=**]',
56+
'test_foo_nested[o_is_a__]',
57+
'test_foo_nested[o_is_b__-a=*]',
58+
'test_foo_nested[o_is_b__-a=**]',
59+
'test_foo_nested2[o_is_a_]', # <- note that case fixture names are the same: correctly reused
60+
'test_foo_nested2[o_is_b_-a=*]',
61+
'test_foo_nested2[o_is_b_-a=**]',
62+
'test_foo_nested2[o_is_a__]',
63+
'test_foo_nested2[o_is_b__-a=*]',
64+
'test_foo_nested2[o_is_b__-a=**]',
65+
# all tests in the module
66+
'test_bar',
67+
'test_foo[o_is_a_]',
68+
'test_foo[o_is_b_-a=*]',
69+
'test_foo[o_is_b_-a=**]',
70+
'test_foo[o_is_a__]',
71+
'test_foo[o_is_b__-a=*]',
72+
'test_foo[o_is_b__-a=**]',
73+
'test_foo2[o_is_a_]', # <- note that case fixture names are the same: correctly reused
74+
'test_foo2[o_is_b_-a=*]',
75+
'test_foo2[o_is_b_-a=**]',
76+
'test_foo2[o_is_a__]',
77+
'test_foo2[o_is_b__-a=*]',
78+
'test_foo2[o_is_b__-a=**]'
6579
]

pytest_cases/tests/cases/issues/test_issue_126_2_cases.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,18 @@ def case_b(b, a):
1414
assert b == -1
1515
assert a in ('*', '**')
1616
return 'case!'
17+
18+
19+
class CaseA:
20+
def case_a(self, b, a):
21+
# a and b are fixtures defined in caller module/class
22+
# note that case id is also 'a'. The goal is to check that no conflict happens here
23+
assert a in (1, 2)
24+
assert b == -1
25+
return 'case!'
26+
27+
@parametrize(a=('*', '**'))
28+
def case_b(self, b, a):
29+
assert b == -1
30+
assert a in ('*', '**')
31+
return 'case!'

0 commit comments

Comments
 (0)