Skip to content

Commit c1bf63c

Browse files
author
Sylvain MARIE
committed
Fixed for pytest 2
1 parent 91b9dcc commit c1bf63c

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed
Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
import pytest
2+
from pytest_cases.common_pytest_marks import has_pytest_param
3+
24
from pytest_cases import fixture, parametrize, fixture_ref
35

46

5-
@fixture
6-
def b():
7-
print("b")
8-
return "b"
7+
if has_pytest_param:
8+
@fixture
9+
def b():
10+
print("b")
11+
return "b"
912

1013

11-
@parametrize("fixture", [fixture_ref(b),
12-
pytest.param(fixture_ref(b))
13-
])
14-
def test(fixture):
15-
assert fixture == "b"
16-
print("Test ran fixure %s" % fixture)
14+
@parametrize("fixture", [fixture_ref(b),
15+
pytest.param(fixture_ref(b))
16+
])
17+
def test(fixture):
18+
assert fixture == "b"
19+
print("Test ran fixure %s" % fixture)
1720

1821

19-
@parametrize("fixture,a", [(fixture_ref(b), 1),
20-
pytest.param(fixture_ref(b), 1)
21-
])
22-
def test2(fixture, a):
23-
assert fixture == "b"
24-
assert a == 1
25-
print("Test ran fixure %s" % fixture)
22+
@parametrize("fixture,a", [(fixture_ref(b), 1),
23+
pytest.param(fixture_ref(b), 1)
24+
])
25+
def test2(fixture, a):
26+
assert fixture == "b"
27+
assert a == 1
28+
print("Test ran fixure %s" % fixture)

0 commit comments

Comments
 (0)