Skip to content

Commit 9f852cd

Browse files
author
Sylvain MARIE
committed
Fixed test on pytest 2
1 parent c065827 commit 9f852cd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pytest_harvest/tests/test_lazy_and_harvest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
import pytest
2+
from distutils.version import LooseVersion
3+
14
from pytest_cases import lazy_value, fixture_ref, parametrize, fixture
25

36
from pytest_harvest import get_session_synthesis_dct
47

58

9+
pytest2 = LooseVersion(pytest.__version__) < LooseVersion("3.0.0")
10+
11+
612
@fixture
713
def b():
814
return 1, "hello"
@@ -50,10 +56,11 @@ def test_synthesis(request, module_results_df):
5056

5157
dct = get_session_synthesis_dct(request, filter=test_foo2, test_id_format="function")
5258
assert len(dct) == 1
53-
i_param = dct["test_foo2[foo]"]["pytest_params"]["i"]
59+
name = "test_foo2[foo]" if not pytest2 else "test_foo2[foo[0]-foo[1]]"
60+
i_param = dct[name]["pytest_params"]["i"]
5461
assert not isinstance(i_param, int)
5562
assert str(i_param) == "foo[0]"
56-
j_param = dct["test_foo2[foo]"]["pytest_params"]["j"]
63+
j_param = dct[name]["pytest_params"]["j"]
5764
assert not isinstance(j_param, int)
5865
assert str(j_param) == "foo[1]"
5966

0 commit comments

Comments
 (0)