[svn r63359] change funcargs naming to use __
--HG-- branch : trunk
This commit is contained in:
parent
2c0ec27d1a
commit
662e6905ef
|
@ -3,9 +3,9 @@ rsyncignore = ['c-extension/greenlet/build']
|
|||
|
||||
import py
|
||||
class PylibTestconfigPlugin:
|
||||
def pytest_funcarg_specssh(self, pyfuncitem):
|
||||
def pytest_funcarg__specssh(self, pyfuncitem):
|
||||
return getspecssh(pyfuncitem.config)
|
||||
def pytest_funcarg_specsocket(self, pyfuncitem):
|
||||
def pytest_funcarg__specsocket(self, pyfuncitem):
|
||||
return getsocketspec(pyfuncitem.config)
|
||||
|
||||
def pytest_addoption(self, parser):
|
||||
|
|
|
@ -111,9 +111,9 @@ class TestGatewayManagerPopen:
|
|||
assert l[0].startswith(curwd)
|
||||
assert l[0].endswith("hello")
|
||||
|
||||
def pytest_funcarg_source(pyfuncitem):
|
||||
def pytest_funcarg__source(pyfuncitem):
|
||||
return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("source")
|
||||
def pytest_funcarg_dest(pyfuncitem):
|
||||
def pytest_funcarg__dest(pyfuncitem):
|
||||
return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("dest")
|
||||
|
||||
class TestHRSync:
|
||||
|
|
|
@ -7,9 +7,9 @@ from py.__.test.dist.nodemanage import NodeManager
|
|||
|
||||
from py.__.test import event
|
||||
|
||||
def pytest_funcarg_source(pyfuncitem):
|
||||
def pytest_funcarg__source(pyfuncitem):
|
||||
return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("source")
|
||||
def pytest_funcarg_dest(pyfuncitem):
|
||||
def pytest_funcarg__dest(pyfuncitem):
|
||||
dest = py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("dest")
|
||||
return dest
|
||||
|
||||
|
|
|
@ -54,12 +54,12 @@ class MySetup:
|
|||
print "exiting:", gw
|
||||
gw.exit()
|
||||
|
||||
def pytest_funcarg_mysetup(pyfuncitem):
|
||||
def pytest_funcarg__mysetup(pyfuncitem):
|
||||
mysetup = MySetup(pyfuncitem)
|
||||
pyfuncitem.addfinalizer(mysetup.finalize)
|
||||
return mysetup
|
||||
|
||||
def pytest_funcarg_testdir(__call__, pyfuncitem):
|
||||
def pytest_funcarg__testdir(__call__, pyfuncitem):
|
||||
# decorate to make us always change to testdir
|
||||
testdir = __call__.execute(firstresult=True)
|
||||
testdir.chdir()
|
||||
|
|
|
@ -2,12 +2,12 @@ import py
|
|||
|
||||
class IocapturePlugin:
|
||||
""" capture sys.stdout/sys.stderr / fd1/fd2. """
|
||||
def pytest_funcarg_stdcapture(self, pyfuncitem):
|
||||
def pytest_funcarg__stdcapture(self, pyfuncitem):
|
||||
capture = Capture(py.io.StdCapture)
|
||||
pyfuncitem.addfinalizer(capture.finalize)
|
||||
return capture
|
||||
|
||||
def pytest_funcarg_stdcapturefd(self, pyfuncitem):
|
||||
def pytest_funcarg__stdcapturefd(self, pyfuncitem):
|
||||
capture = Capture(py.io.StdCaptureFD)
|
||||
pyfuncitem.addfinalizer(capture.finalize)
|
||||
return capture
|
||||
|
|
|
@ -2,7 +2,7 @@ import os
|
|||
|
||||
class MonkeypatchPlugin:
|
||||
""" setattr-monkeypatching with automatical reversal after test. """
|
||||
def pytest_funcarg_monkeypatch(self, pyfuncitem):
|
||||
def pytest_funcarg__monkeypatch(self, pyfuncitem):
|
||||
monkeypatch = MonkeyPatch()
|
||||
pyfuncitem.addfinalizer(monkeypatch.finalize)
|
||||
return monkeypatch
|
||||
|
|
|
@ -5,7 +5,7 @@ import py
|
|||
|
||||
class PlugintesterPlugin:
|
||||
""" test support code for testing pytest plugins. """
|
||||
def pytest_funcarg_plugintester(self, pyfuncitem):
|
||||
def pytest_funcarg__plugintester(self, pyfuncitem):
|
||||
pt = PluginTester(pyfuncitem)
|
||||
pyfuncitem.addfinalizer(pt.finalize)
|
||||
return pt
|
||||
|
@ -46,7 +46,7 @@ class PluginTester(Support):
|
|||
getargs = py.std.inspect.getargs
|
||||
|
||||
def isgenerichook(name):
|
||||
return name.startswith("pytest_funcarg_")
|
||||
return name.startswith("pytest_funcarg__")
|
||||
|
||||
while methods:
|
||||
name, method = methods.popitem()
|
||||
|
|
|
@ -7,21 +7,21 @@ from py.__.test import event
|
|||
from py.__.test.config import Config as pytestConfig
|
||||
|
||||
class PytesterPlugin:
|
||||
def pytest_funcarg_linecomp(self, pyfuncitem):
|
||||
def pytest_funcarg__linecomp(self, pyfuncitem):
|
||||
return LineComp()
|
||||
|
||||
def pytest_funcarg_LineMatcher(self, pyfuncitem):
|
||||
def pytest_funcarg__LineMatcher(self, pyfuncitem):
|
||||
return LineMatcher
|
||||
|
||||
def pytest_funcarg_testdir(self, pyfuncitem):
|
||||
def pytest_funcarg__testdir(self, pyfuncitem):
|
||||
tmptestdir = TmpTestdir(pyfuncitem)
|
||||
pyfuncitem.addfinalizer(tmptestdir.finalize)
|
||||
return tmptestdir
|
||||
|
||||
def pytest_funcarg_EventRecorder(self, pyfuncitem):
|
||||
def pytest_funcarg__EventRecorder(self, pyfuncitem):
|
||||
return EventRecorder
|
||||
|
||||
def pytest_funcarg_eventrecorder(self, pyfuncitem):
|
||||
def pytest_funcarg__eventrecorder(self, pyfuncitem):
|
||||
evrec = EventRecorder(py._com.pyplugins)
|
||||
pyfuncitem.addfinalizer(lambda: evrec.pyplugins.unregister(evrec))
|
||||
return evrec
|
||||
|
|
|
@ -328,7 +328,7 @@ class TestApigenLinkRole:
|
|||
"resolve_linkrole('source', 'py/foo/bar.py')")
|
||||
|
||||
|
||||
def pytest_funcarg_testdir(__call__, pyfuncitem):
|
||||
def pytest_funcarg__testdir(__call__, pyfuncitem):
|
||||
testdir = __call__.execute(firstresult=True)
|
||||
testdir.makepyfile(confrest="from py.__.misc.rest import Project")
|
||||
testdir.plugins.append(RestdocPlugin())
|
||||
|
|
|
@ -13,7 +13,7 @@ class TmpdirPlugin:
|
|||
""" provide temporary directories to test functions and methods.
|
||||
"""
|
||||
|
||||
def pytest_funcarg_tmpdir(self, pyfuncitem):
|
||||
def pytest_funcarg__tmpdir(self, pyfuncitem):
|
||||
name = pyfuncitem.name
|
||||
return pyfuncitem.config.mktemp(name, numbered=True)
|
||||
|
||||
|
@ -29,7 +29,7 @@ def test_generic(plugintester):
|
|||
def test_funcarg(testdir):
|
||||
item = testdir.getitem("def test_func(tmpdir): pass")
|
||||
plugin = TmpdirPlugin()
|
||||
p = plugin.pytest_funcarg_tmpdir(item)
|
||||
p = plugin.pytest_funcarg__tmpdir(item)
|
||||
assert p.check()
|
||||
bn = p.basename.strip("0123456789-")
|
||||
assert bn.endswith("test_func")
|
||||
|
|
|
@ -375,7 +375,7 @@ class Function(FunctionMixin, py.test.collect.Item):
|
|||
return kwargs
|
||||
|
||||
def lookup_onearg(self, argname):
|
||||
prefix = "pytest_funcarg_"
|
||||
prefix = "pytest_funcarg__"
|
||||
#makerlist = self.config.pytestplugins.listattr(prefix + argname)
|
||||
value = self.config.pytestplugins.call_firstresult(prefix + argname, pyfuncitem=self)
|
||||
if value is not None:
|
||||
|
@ -383,7 +383,7 @@ class Function(FunctionMixin, py.test.collect.Item):
|
|||
else:
|
||||
self._raisefuncargerror(argname, prefix)
|
||||
|
||||
def _raisefuncargerror(self, argname, prefix="pytest_funcarg_"):
|
||||
def _raisefuncargerror(self, argname, prefix="pytest_funcarg__"):
|
||||
metainfo = self.repr_metainfo()
|
||||
available = []
|
||||
plugins = self.config.pytestplugins._plugins.values()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import py
|
||||
|
||||
def pytest_funcarg_pickletransport(pyfuncitem):
|
||||
def pytest_funcarg__pickletransport(pyfuncitem):
|
||||
return ImmutablePickleTransport()
|
||||
|
||||
def pytest_pyfunc_call(__call__, pyfuncitem, args, kwargs):
|
||||
|
|
|
@ -252,7 +252,7 @@ class TestFunction:
|
|||
def test_funcarg_lookupfails(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
class ConftestPlugin:
|
||||
def pytest_funcarg_something(self, pyfuncitem):
|
||||
def pytest_funcarg__something(self, pyfuncitem):
|
||||
return 42
|
||||
""")
|
||||
item = testdir.getitem("def test_func(some): pass")
|
||||
|
@ -263,7 +263,7 @@ class TestFunction:
|
|||
def test_funcarg_lookup_default(self, testdir):
|
||||
item = testdir.getitem("def test_func(some, other=42): pass")
|
||||
class Provider:
|
||||
def pytest_funcarg_some(self, pyfuncitem):
|
||||
def pytest_funcarg__some(self, pyfuncitem):
|
||||
return pyfuncitem.name
|
||||
item.config.pytestplugins.register(Provider())
|
||||
kw = item.lookup_allargs()
|
||||
|
@ -272,7 +272,7 @@ class TestFunction:
|
|||
def test_funcarg_lookup_default_gets_overriden(self, testdir):
|
||||
item = testdir.getitem("def test_func(some=42, other=13): pass")
|
||||
class Provider:
|
||||
def pytest_funcarg_other(self, pyfuncitem):
|
||||
def pytest_funcarg__other(self, pyfuncitem):
|
||||
return pyfuncitem.name
|
||||
item.config.pytestplugins.register(Provider())
|
||||
kw = item.lookup_allargs()
|
||||
|
@ -284,9 +284,9 @@ class TestFunction:
|
|||
def test_funcarg_basic(self, testdir):
|
||||
item = testdir.getitem("def test_func(some, other): pass")
|
||||
class Provider:
|
||||
def pytest_funcarg_some(self, pyfuncitem):
|
||||
def pytest_funcarg__some(self, pyfuncitem):
|
||||
return pyfuncitem.name
|
||||
def pytest_funcarg_other(self, pyfuncitem):
|
||||
def pytest_funcarg__other(self, pyfuncitem):
|
||||
return 42
|
||||
item.config.pytestplugins.register(Provider())
|
||||
kw = item.lookup_allargs()
|
||||
|
@ -298,7 +298,7 @@ class TestFunction:
|
|||
item = testdir.getitem("def test_func(some): pass")
|
||||
l = []
|
||||
class Provider:
|
||||
def pytest_funcarg_some(self, pyfuncitem):
|
||||
def pytest_funcarg__some(self, pyfuncitem):
|
||||
pyfuncitem.addfinalizer(lambda: l.append(42))
|
||||
return 3
|
||||
item.config.pytestplugins.register(Provider())
|
||||
|
@ -312,7 +312,7 @@ class TestFunction:
|
|||
|
||||
def test_funcarg_lookup_modulelevel(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
def pytest_funcarg_something(pyfuncitem):
|
||||
def pytest_funcarg__something(pyfuncitem):
|
||||
return pyfuncitem.name
|
||||
|
||||
class TestClass:
|
||||
|
|
|
@ -10,7 +10,7 @@ class TestTracebackCutting:
|
|||
def test_traceback_argsetup(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
class ConftestPlugin:
|
||||
def pytest_funcarg_hello(self, pyfuncitem):
|
||||
def pytest_funcarg__hello(self, pyfuncitem):
|
||||
raise ValueError("xyz")
|
||||
""")
|
||||
p = testdir.makepyfile("def test(hello): pass")
|
||||
|
|
Loading…
Reference in New Issue