Replace "pytest_funcarg__" by @pytest.fixture

This commit is contained in:
Bruno Oliveira
2016-08-04 20:26:08 -03:00
parent e8fa737196
commit 7d124ecf87
4 changed files with 13 additions and 6 deletions

View File

@@ -411,7 +411,9 @@ def test_session_testscollected(testdir):
def test_funcarg_teardown_failure(testdir):
p = testdir.makepyfile("""
def pytest_funcarg__myarg(request):
import pytest
@pytest.fixture
def myarg(request):
def teardown(val):
raise ValueError(val)
return request.cached_setup(setup=lambda: 42, teardown=teardown,

View File

@@ -37,7 +37,8 @@ def pytest_addoption(parser):
help=("add a global test environment, XSpec-syntax. "))
def pytest_funcarg__specssh(request):
@pytest.fixture
def specssh(request):
return getspecssh(request.config)

View File

@@ -59,7 +59,8 @@ class SlaveSetup:
self.slp.sendcommand(name, **kwargs)
def pytest_funcarg__slave(request):
@pytest.fixture
def slave(request):
return SlaveSetup(request)

View File

@@ -8,7 +8,8 @@ from xdist.slavemanage import HostRSync, NodeManager
pytest_plugins = "pytester"
def pytest_funcarg__hookrecorder(request, config):
@pytest.fixture
def hookrecorder(request, config):
hookrecorder = HookRecorder(config.pluginmanager)
if hasattr(hookrecorder, "start_recording"):
hookrecorder.start_recording(newhooks)
@@ -16,11 +17,13 @@ def pytest_funcarg__hookrecorder(request, config):
return hookrecorder
def pytest_funcarg__config(testdir):
@pytest.fixture
def config(testdir):
return testdir.parseconfig()
def pytest_funcarg__mysetup(tmpdir):
@pytest.fixture
def mysetup(tmpdir):
class mysetup:
source = tmpdir.mkdir("source")
dest = tmpdir.mkdir("dest")