improve error representation for missing factory definitions

in recursive funcarg reconstruction
This commit is contained in:
holger krekel
2012-08-08 11:48:53 +02:00
parent 172505f703
commit dd268c1b2b
5 changed files with 56 additions and 22 deletions

View File

@@ -2319,7 +2319,7 @@ class TestTestContextScopeAccess:
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
def test_resource(self, testdir, scope, ok, error):
def test_funcarg(self, testdir, scope, ok, error):
testdir.makepyfile("""
import pytest
@pytest.factory(scope=%r)
@@ -2337,6 +2337,23 @@ class TestTestContextScopeAccess:
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
def test_illdefined_factory(testdir):
testdir.makepyfile("""
import pytest
@pytest.factory()
def gen(request):
return 1
def test_something(gen):
pass
""")
result = testdir.runpytest()
assert result.ret != 0
result.stdout.fnmatch_lines([
"*def gen(request):*",
"*no factory*request*",
])
class TestTestContextVarious:
def test_newstyle_no_request(self, testdir):
testdir.makepyfile("""