add an xfail-ed test for a potential future "enabled" parameter to setup functions

This commit is contained in:
holger krekel
2012-09-25 15:04:30 +02:00
parent fe4ccdff0e
commit a1c3d60747
2 changed files with 34 additions and 3 deletions

View File

@@ -1898,6 +1898,32 @@ class TestSetupDiscovery:
reprec = testdir.inline_run("-s")
reprec.assertoutcome(passed=2)
@pytest.mark.xfail(reason="'enabled' feature not implemented")
def test_setup_enabled_functionnode(self, testdir):
testdir.makepyfile("""
import pytest
def enabled(parentnode, markers):
return "needsdb" in markers
@pytest.factory(params=[1,2])
def db(request):
return request.param
@pytest.setup(enabled=enabled)
def createdb(db):
pass
def test_func1(request):
assert "db" not in request.funcargnames
@pytest.mark.needsdb
def test_func2(request):
assert "db" in request.funcargnames
""")
reprec = testdir.inline_run("-s")
reprec.assertoutcome(passed=2)
def test_callables_nocode(self, testdir):
"""
a imported mock.call would break setup/factory discovery