44# License: 3-clause BSD, <https://github.com/smarie/python-pytest-cases/blob/master/LICENSE>
55import pytest
66
7- from pytest_cases .common_pytest_marks import PYTEST3_OR_GREATER , PYTEST361_36X , PYTEST811
7+ from pytest_cases .common_pytest_marks import PYTEST3_OR_GREATER , PYTEST361_36X , PYTEST811 , PYTEST81_OR_GREATER
88
99
1010def test_config (request ):
@@ -30,15 +30,32 @@ def test2(reprovision):
3030 pass
3131
3232
33- @pytest .mark .skipif ((not PYTEST3_OR_GREATER ) or PYTEST361_36X or PYTEST811 ,
33+ @pytest .mark .skipif ((not PYTEST3_OR_GREATER ) or PYTEST361_36X ,
3434 reason = "This 'optimal order' was changed in some versions of pytest" )
3535def test_synthesis (module_results_dct ):
36- assert list (module_results_dct ) == ['test_config' ,
37- 'test[flavor1-vxlan]' ,
38- 'test2[flavor1-vxlan]' ,
39- 'test[flavor2-vxlan]' ,
40- 'test2[flavor2-vxlan]' ,
41- 'test[flavor2-vlan]' ,
42- 'test2[flavor2-vlan]' ,
43- 'test[flavor1-vlan]' ,
44- 'test2[flavor1-vlan]' ]
36+ if PYTEST81_OR_GREATER :
37+ # new 'optimal order'
38+ assert list (module_results_dct ) == [
39+ 'test_config' ,
40+ 'test[flavor1-vxlan]' ,
41+ 'test2[flavor1-vxlan]' ,
42+ 'test[flavor1-vlan]' ,
43+ 'test2[flavor1-vlan]' ,
44+ 'test[flavor2-vlan]' ,
45+ 'test2[flavor2-vlan]' ,
46+ 'test[flavor2-vxlan]' ,
47+ 'test2[flavor2-vxlan]' ,
48+ ]
49+ else :
50+ # legacy 'optimal order'
51+ assert list (module_results_dct ) == [
52+ 'test_config' ,
53+ 'test[flavor1-vxlan]' ,
54+ 'test2[flavor1-vxlan]' ,
55+ 'test[flavor2-vxlan]' ,
56+ 'test2[flavor2-vxlan]' ,
57+ 'test[flavor2-vlan]' ,
58+ 'test2[flavor2-vlan]' ,
59+ 'test[flavor1-vlan]' ,
60+ 'test2[flavor1-vlan]'
61+ ]
0 commit comments