Skip to content

Commit

Permalink
Fixed test with pytest 8.1+
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain MARIE committed Sep 26, 2024
1 parent f9f199e commit 201bb14
Showing 1 changed file with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License: 3-clause BSD, <https://github.com/smarie/python-pytest-cases/blob/master/LICENSE>
import pytest

from pytest_cases.common_pytest_marks import PYTEST3_OR_GREATER, PYTEST361_36X, PYTEST811
from pytest_cases.common_pytest_marks import PYTEST3_OR_GREATER, PYTEST361_36X, PYTEST811, PYTEST81_OR_GREATER


def test_config(request):
Expand All @@ -30,15 +30,32 @@ def test2(reprovision):
pass


@pytest.mark.skipif((not PYTEST3_OR_GREATER) or PYTEST361_36X or PYTEST811,
@pytest.mark.skipif((not PYTEST3_OR_GREATER) or PYTEST361_36X,
reason="This 'optimal order' was changed in some versions of pytest")
def test_synthesis(module_results_dct):
assert list(module_results_dct) == ['test_config',
'test[flavor1-vxlan]',
'test2[flavor1-vxlan]',
'test[flavor2-vxlan]',
'test2[flavor2-vxlan]',
'test[flavor2-vlan]',
'test2[flavor2-vlan]',
'test[flavor1-vlan]',
'test2[flavor1-vlan]']
if PYTEST81_OR_GREATER:
# new 'optimal order'
assert list(module_results_dct) == [
'test_config',
'test[flavor1-vxlan]',
'test2[flavor1-vxlan]',
'test[flavor1-vlan]',
'test2[flavor1-vlan]',
'test[flavor2-vlan]',
'test2[flavor2-vlan]',
'test[flavor2-vxlan]',
'test2[flavor2-vxlan]',
]
else:
# legacy 'optimal order'
assert list(module_results_dct) == [
'test_config',
'test[flavor1-vxlan]',
'test2[flavor1-vxlan]',
'test[flavor2-vxlan]',
'test2[flavor2-vxlan]',
'test[flavor2-vlan]',
'test2[flavor2-vlan]',
'test[flavor1-vlan]',
'test2[flavor1-vlan]'
]

0 comments on commit 201bb14

Please sign in to comment.