Skip to content

Commit a19f8bf

Browse files
author
Sylvain MARIE
committed
Slightly reorganized tests.
1 parent 6979d13 commit a19f8bf

8 files changed

+18
-22
lines changed

pytest_cases/tests/fixtures/__init__.py

Whitespace-only changes.

pytest_cases/tests/simple/test_paramfixtures.py renamed to pytest_cases/tests/fixtures/test_fixtures_paramfixtures.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def pytest_param(*args, **kwargs):
1212
return args
1313

1414

15+
# ---------- (1)
1516
# create a single parameter fixture with and without explicit symbol creation
1617
param_fixture("my_parameter", [1, 2])
1718
my_parameter2 = param_fixture("my_parameter2", [3, 4]) # Returning value
@@ -27,7 +28,7 @@ def test_uses_param(my_parameter, my_parameter2, fixture_uses_param):
2728
assert my_parameter, my_parameter2 == fixture_uses_param
2829

2930

30-
# -----
31+
# ---------- (2)
3132
# create a 2-tuple parameter fixture without symbol creation
3233
param_fixtures("arg1, arg2", [(1, 2), (3, 4)])
3334

@@ -47,8 +48,7 @@ def test_uses_param2(arg1, arg2, parg3, fixture_uses_param2):
4748
assert parg3 in [5, 6]
4849

4950

50-
# -----------
51-
51+
# ---------- (3)
5252
param_fixtures("parg1, parg2", [("a", "b"), ("c", "d")])
5353
"""Two parameter fixtures"""
5454

@@ -67,7 +67,7 @@ def myfix(arg1, arg2, parg1):
6767
pytest_param(10, 20, id="t_a"),
6868
pytest_param(30, 40, id="t_b")
6969
])
70-
def test_one(myfix, arg3, arg4, parg1, parg2, request):
70+
def test_custom_parameters(myfix, arg3, arg4, parg1, parg2, request):
7171
""""""
7272
assert myfix[2] == parg1
7373
paramvalues = request.node.nodeid.split('[')[1][:-1]
@@ -85,24 +85,20 @@ def test_one(myfix, arg3, arg4, parg1, parg2, request):
8585
def test_synthesis(module_results_dct):
8686
"""Use pytest-harvest to check that the list of executed tests is correct """
8787

88-
if LooseVersion(pytest.__version__) >= LooseVersion('3.0.0'):
89-
end_list = ['test_one[f_a-a-b-t_a]',
90-
'test_one[f_a-a-b-t_b]',
91-
'test_one[f_a-c-d-t_a]',
92-
'test_one[f_a-c-d-t_b]',
93-
'test_one[f_b-a-b-t_a]',
94-
'test_one[f_b-a-b-t_b]',
95-
'test_one[f_b-c-d-t_a]',
96-
'test_one[f_b-c-d-t_b]']
97-
else:
98-
end_list = [ 'test_one[1-2-a-b-10-20]',
99-
'test_one[1-2-a-b-30-40]',
100-
'test_one[1-2-c-d-10-20]',
101-
'test_one[1-2-c-d-30-40]',
102-
'test_one[3-4-a-b-10-20]',
103-
'test_one[3-4-a-b-30-40]',
104-
'test_one[3-4-c-d-10-20]',
105-
'test_one[3-4-c-d-30-40]']
88+
end_list = ['test_custom_parameters[f_a-a-b-t_a]',
89+
'test_custom_parameters[f_a-a-b-t_b]',
90+
'test_custom_parameters[f_a-c-d-t_a]',
91+
'test_custom_parameters[f_a-c-d-t_b]',
92+
'test_custom_parameters[f_b-a-b-t_a]',
93+
'test_custom_parameters[f_b-a-b-t_b]',
94+
'test_custom_parameters[f_b-c-d-t_a]',
95+
'test_custom_parameters[f_b-c-d-t_b]']
96+
97+
if LooseVersion(pytest.__version__) < LooseVersion('3.0.0'):
98+
end_list = [s.replace('t_a', '10-20')
99+
.replace('t_b', '30-40')
100+
.replace('f_a', '1-2')
101+
.replace('f_b', '3-4') for s in end_list]
106102

107103
assert list(module_results_dct) == ['test_uses_param[1-3]',
108104
'test_uses_param[1-4]',

0 commit comments

Comments
 (0)