allow registration of "funcarg" marked factories

This commit is contained in:
holger krekel
2012-07-20 14:16:49 +02:00
parent 80db25822c
commit 396045e53f
2 changed files with 36 additions and 5 deletions

View File

@@ -1805,3 +1805,25 @@ class TestFuncargMarker:
"*ScopeMismatch*You tried*function*from*session*",
])
def test_register_only_with_mark(self, testdir):
testdir.makeconftest("""
import pytest
finalized = []
created = []
@pytest.mark.funcarg
def arg(request):
return 1
""")
testdir.makepyfile(
test_mod1="""
import pytest
@pytest.mark.funcarg
def arg(request):
return request.getfuncargvalue("arg") + 1
def test_1(arg):
assert arg == 2
""")
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)