implement a scope/parametrized examples using the so-far new features

also fix a bug with scoping/parametrization
This commit is contained in:
holger krekel
2012-07-20 14:16:50 +02:00
parent 396045e53f
commit 6b0f0adf5b
8 changed files with 222 additions and 6 deletions

View File

@@ -1826,4 +1826,17 @@ class TestFuncargMarker:
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
def test_parametrize_and_scope(self, testdir):
testdir.makepyfile("""
import pytest
@pytest.mark.funcarg(scope="module", params=["a", "b", "c"])
def pytest_funcarg__arg(request):
return request.param
l = []
def test_param(arg):
l.append(arg)
def test_result():
assert l == list("abc")
""")
reprec = testdir.inline_run()
reprec.assertoutcome(passed=4)