Merge pull request #77 from nicoddemus/funcarg
Replace "pytest_funcarg__" by @pytest.fixture
This commit is contained in:
@@ -411,7 +411,9 @@ def test_session_testscollected(testdir):
|
|||||||
|
|
||||||
def test_funcarg_teardown_failure(testdir):
|
def test_funcarg_teardown_failure(testdir):
|
||||||
p = testdir.makepyfile("""
|
p = testdir.makepyfile("""
|
||||||
def pytest_funcarg__myarg(request):
|
import pytest
|
||||||
|
@pytest.fixture
|
||||||
|
def myarg(request):
|
||||||
def teardown(val):
|
def teardown(val):
|
||||||
raise ValueError(val)
|
raise ValueError(val)
|
||||||
return request.cached_setup(setup=lambda: 42, teardown=teardown,
|
return request.cached_setup(setup=lambda: 42, teardown=teardown,
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ def pytest_addoption(parser):
|
|||||||
help=("add a global test environment, XSpec-syntax. "))
|
help=("add a global test environment, XSpec-syntax. "))
|
||||||
|
|
||||||
|
|
||||||
def pytest_funcarg__specssh(request):
|
@pytest.fixture
|
||||||
|
def specssh(request):
|
||||||
return getspecssh(request.config)
|
return getspecssh(request.config)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ class SlaveSetup:
|
|||||||
self.slp.sendcommand(name, **kwargs)
|
self.slp.sendcommand(name, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def pytest_funcarg__slave(request):
|
@pytest.fixture
|
||||||
|
def slave(request):
|
||||||
return SlaveSetup(request)
|
return SlaveSetup(request)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ from xdist.slavemanage import HostRSync, NodeManager
|
|||||||
pytest_plugins = "pytester"
|
pytest_plugins = "pytester"
|
||||||
|
|
||||||
|
|
||||||
def pytest_funcarg__hookrecorder(request, config):
|
@pytest.fixture
|
||||||
|
def hookrecorder(request, config):
|
||||||
hookrecorder = HookRecorder(config.pluginmanager)
|
hookrecorder = HookRecorder(config.pluginmanager)
|
||||||
if hasattr(hookrecorder, "start_recording"):
|
if hasattr(hookrecorder, "start_recording"):
|
||||||
hookrecorder.start_recording(newhooks)
|
hookrecorder.start_recording(newhooks)
|
||||||
@@ -16,11 +17,13 @@ def pytest_funcarg__hookrecorder(request, config):
|
|||||||
return hookrecorder
|
return hookrecorder
|
||||||
|
|
||||||
|
|
||||||
def pytest_funcarg__config(testdir):
|
@pytest.fixture
|
||||||
|
def config(testdir):
|
||||||
return testdir.parseconfig()
|
return testdir.parseconfig()
|
||||||
|
|
||||||
|
|
||||||
def pytest_funcarg__mysetup(tmpdir):
|
@pytest.fixture
|
||||||
|
def mysetup(tmpdir):
|
||||||
class mysetup:
|
class mysetup:
|
||||||
source = tmpdir.mkdir("source")
|
source = tmpdir.mkdir("source")
|
||||||
dest = tmpdir.mkdir("dest")
|
dest = tmpdir.mkdir("dest")
|
||||||
|
|||||||
Reference in New Issue
Block a user