[svn r63359] change funcargs naming to use __

--HG--
branch : trunk
This commit is contained in:
hpk 2009-03-26 13:50:12 +01:00
parent 2c0ec27d1a
commit 662e6905ef
14 changed files with 32 additions and 32 deletions

View File

@ -3,9 +3,9 @@ rsyncignore = ['c-extension/greenlet/build']
import py import py
class PylibTestconfigPlugin: class PylibTestconfigPlugin:
def pytest_funcarg_specssh(self, pyfuncitem): def pytest_funcarg__specssh(self, pyfuncitem):
return getspecssh(pyfuncitem.config) return getspecssh(pyfuncitem.config)
def pytest_funcarg_specsocket(self, pyfuncitem): def pytest_funcarg__specsocket(self, pyfuncitem):
return getsocketspec(pyfuncitem.config) return getsocketspec(pyfuncitem.config)
def pytest_addoption(self, parser): def pytest_addoption(self, parser):

View File

@ -111,9 +111,9 @@ class TestGatewayManagerPopen:
assert l[0].startswith(curwd) assert l[0].startswith(curwd)
assert l[0].endswith("hello") assert l[0].endswith("hello")
def pytest_funcarg_source(pyfuncitem): def pytest_funcarg__source(pyfuncitem):
return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("source") 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") return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("dest")
class TestHRSync: class TestHRSync:

View File

@ -7,9 +7,9 @@ from py.__.test.dist.nodemanage import NodeManager
from py.__.test import event from py.__.test import event
def pytest_funcarg_source(pyfuncitem): def pytest_funcarg__source(pyfuncitem):
return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("source") 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") dest = py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("dest")
return dest return dest

View File

@ -54,12 +54,12 @@ class MySetup:
print "exiting:", gw print "exiting:", gw
gw.exit() gw.exit()
def pytest_funcarg_mysetup(pyfuncitem): def pytest_funcarg__mysetup(pyfuncitem):
mysetup = MySetup(pyfuncitem) mysetup = MySetup(pyfuncitem)
pyfuncitem.addfinalizer(mysetup.finalize) pyfuncitem.addfinalizer(mysetup.finalize)
return mysetup return mysetup
def pytest_funcarg_testdir(__call__, pyfuncitem): def pytest_funcarg__testdir(__call__, pyfuncitem):
# decorate to make us always change to testdir # decorate to make us always change to testdir
testdir = __call__.execute(firstresult=True) testdir = __call__.execute(firstresult=True)
testdir.chdir() testdir.chdir()

View File

@ -2,12 +2,12 @@ import py
class IocapturePlugin: class IocapturePlugin:
""" capture sys.stdout/sys.stderr / fd1/fd2. """ """ capture sys.stdout/sys.stderr / fd1/fd2. """
def pytest_funcarg_stdcapture(self, pyfuncitem): def pytest_funcarg__stdcapture(self, pyfuncitem):
capture = Capture(py.io.StdCapture) capture = Capture(py.io.StdCapture)
pyfuncitem.addfinalizer(capture.finalize) pyfuncitem.addfinalizer(capture.finalize)
return capture return capture
def pytest_funcarg_stdcapturefd(self, pyfuncitem): def pytest_funcarg__stdcapturefd(self, pyfuncitem):
capture = Capture(py.io.StdCaptureFD) capture = Capture(py.io.StdCaptureFD)
pyfuncitem.addfinalizer(capture.finalize) pyfuncitem.addfinalizer(capture.finalize)
return capture return capture

View File

@ -2,7 +2,7 @@ import os
class MonkeypatchPlugin: class MonkeypatchPlugin:
""" setattr-monkeypatching with automatical reversal after test. """ """ setattr-monkeypatching with automatical reversal after test. """
def pytest_funcarg_monkeypatch(self, pyfuncitem): def pytest_funcarg__monkeypatch(self, pyfuncitem):
monkeypatch = MonkeyPatch() monkeypatch = MonkeyPatch()
pyfuncitem.addfinalizer(monkeypatch.finalize) pyfuncitem.addfinalizer(monkeypatch.finalize)
return monkeypatch return monkeypatch

View File

@ -5,7 +5,7 @@ import py
class PlugintesterPlugin: class PlugintesterPlugin:
""" test support code for testing pytest plugins. """ """ test support code for testing pytest plugins. """
def pytest_funcarg_plugintester(self, pyfuncitem): def pytest_funcarg__plugintester(self, pyfuncitem):
pt = PluginTester(pyfuncitem) pt = PluginTester(pyfuncitem)
pyfuncitem.addfinalizer(pt.finalize) pyfuncitem.addfinalizer(pt.finalize)
return pt return pt
@ -46,7 +46,7 @@ class PluginTester(Support):
getargs = py.std.inspect.getargs getargs = py.std.inspect.getargs
def isgenerichook(name): def isgenerichook(name):
return name.startswith("pytest_funcarg_") return name.startswith("pytest_funcarg__")
while methods: while methods:
name, method = methods.popitem() name, method = methods.popitem()

View File

@ -7,21 +7,21 @@ from py.__.test import event
from py.__.test.config import Config as pytestConfig from py.__.test.config import Config as pytestConfig
class PytesterPlugin: class PytesterPlugin:
def pytest_funcarg_linecomp(self, pyfuncitem): def pytest_funcarg__linecomp(self, pyfuncitem):
return LineComp() return LineComp()
def pytest_funcarg_LineMatcher(self, pyfuncitem): def pytest_funcarg__LineMatcher(self, pyfuncitem):
return LineMatcher return LineMatcher
def pytest_funcarg_testdir(self, pyfuncitem): def pytest_funcarg__testdir(self, pyfuncitem):
tmptestdir = TmpTestdir(pyfuncitem) tmptestdir = TmpTestdir(pyfuncitem)
pyfuncitem.addfinalizer(tmptestdir.finalize) pyfuncitem.addfinalizer(tmptestdir.finalize)
return tmptestdir return tmptestdir
def pytest_funcarg_EventRecorder(self, pyfuncitem): def pytest_funcarg__EventRecorder(self, pyfuncitem):
return EventRecorder return EventRecorder
def pytest_funcarg_eventrecorder(self, pyfuncitem): def pytest_funcarg__eventrecorder(self, pyfuncitem):
evrec = EventRecorder(py._com.pyplugins) evrec = EventRecorder(py._com.pyplugins)
pyfuncitem.addfinalizer(lambda: evrec.pyplugins.unregister(evrec)) pyfuncitem.addfinalizer(lambda: evrec.pyplugins.unregister(evrec))
return evrec return evrec

View File

@ -328,7 +328,7 @@ class TestApigenLinkRole:
"resolve_linkrole('source', 'py/foo/bar.py')") "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 = __call__.execute(firstresult=True)
testdir.makepyfile(confrest="from py.__.misc.rest import Project") testdir.makepyfile(confrest="from py.__.misc.rest import Project")
testdir.plugins.append(RestdocPlugin()) testdir.plugins.append(RestdocPlugin())

View File

@ -13,7 +13,7 @@ class TmpdirPlugin:
""" provide temporary directories to test functions and methods. """ provide temporary directories to test functions and methods.
""" """
def pytest_funcarg_tmpdir(self, pyfuncitem): def pytest_funcarg__tmpdir(self, pyfuncitem):
name = pyfuncitem.name name = pyfuncitem.name
return pyfuncitem.config.mktemp(name, numbered=True) return pyfuncitem.config.mktemp(name, numbered=True)
@ -29,7 +29,7 @@ def test_generic(plugintester):
def test_funcarg(testdir): def test_funcarg(testdir):
item = testdir.getitem("def test_func(tmpdir): pass") item = testdir.getitem("def test_func(tmpdir): pass")
plugin = TmpdirPlugin() plugin = TmpdirPlugin()
p = plugin.pytest_funcarg_tmpdir(item) p = plugin.pytest_funcarg__tmpdir(item)
assert p.check() assert p.check()
bn = p.basename.strip("0123456789-") bn = p.basename.strip("0123456789-")
assert bn.endswith("test_func") assert bn.endswith("test_func")

View File

@ -375,7 +375,7 @@ class Function(FunctionMixin, py.test.collect.Item):
return kwargs return kwargs
def lookup_onearg(self, argname): def lookup_onearg(self, argname):
prefix = "pytest_funcarg_" prefix = "pytest_funcarg__"
#makerlist = self.config.pytestplugins.listattr(prefix + argname) #makerlist = self.config.pytestplugins.listattr(prefix + argname)
value = self.config.pytestplugins.call_firstresult(prefix + argname, pyfuncitem=self) value = self.config.pytestplugins.call_firstresult(prefix + argname, pyfuncitem=self)
if value is not None: if value is not None:
@ -383,7 +383,7 @@ class Function(FunctionMixin, py.test.collect.Item):
else: else:
self._raisefuncargerror(argname, prefix) self._raisefuncargerror(argname, prefix)
def _raisefuncargerror(self, argname, prefix="pytest_funcarg_"): def _raisefuncargerror(self, argname, prefix="pytest_funcarg__"):
metainfo = self.repr_metainfo() metainfo = self.repr_metainfo()
available = [] available = []
plugins = self.config.pytestplugins._plugins.values() plugins = self.config.pytestplugins._plugins.values()

View File

@ -1,6 +1,6 @@
import py import py
def pytest_funcarg_pickletransport(pyfuncitem): def pytest_funcarg__pickletransport(pyfuncitem):
return ImmutablePickleTransport() return ImmutablePickleTransport()
def pytest_pyfunc_call(__call__, pyfuncitem, args, kwargs): def pytest_pyfunc_call(__call__, pyfuncitem, args, kwargs):

View File

@ -252,7 +252,7 @@ class TestFunction:
def test_funcarg_lookupfails(self, testdir): def test_funcarg_lookupfails(self, testdir):
testdir.makeconftest(""" testdir.makeconftest("""
class ConftestPlugin: class ConftestPlugin:
def pytest_funcarg_something(self, pyfuncitem): def pytest_funcarg__something(self, pyfuncitem):
return 42 return 42
""") """)
item = testdir.getitem("def test_func(some): pass") item = testdir.getitem("def test_func(some): pass")
@ -263,7 +263,7 @@ class TestFunction:
def test_funcarg_lookup_default(self, testdir): def test_funcarg_lookup_default(self, testdir):
item = testdir.getitem("def test_func(some, other=42): pass") item = testdir.getitem("def test_func(some, other=42): pass")
class Provider: class Provider:
def pytest_funcarg_some(self, pyfuncitem): def pytest_funcarg__some(self, pyfuncitem):
return pyfuncitem.name return pyfuncitem.name
item.config.pytestplugins.register(Provider()) item.config.pytestplugins.register(Provider())
kw = item.lookup_allargs() kw = item.lookup_allargs()
@ -272,7 +272,7 @@ class TestFunction:
def test_funcarg_lookup_default_gets_overriden(self, testdir): def test_funcarg_lookup_default_gets_overriden(self, testdir):
item = testdir.getitem("def test_func(some=42, other=13): pass") item = testdir.getitem("def test_func(some=42, other=13): pass")
class Provider: class Provider:
def pytest_funcarg_other(self, pyfuncitem): def pytest_funcarg__other(self, pyfuncitem):
return pyfuncitem.name return pyfuncitem.name
item.config.pytestplugins.register(Provider()) item.config.pytestplugins.register(Provider())
kw = item.lookup_allargs() kw = item.lookup_allargs()
@ -284,9 +284,9 @@ class TestFunction:
def test_funcarg_basic(self, testdir): def test_funcarg_basic(self, testdir):
item = testdir.getitem("def test_func(some, other): pass") item = testdir.getitem("def test_func(some, other): pass")
class Provider: class Provider:
def pytest_funcarg_some(self, pyfuncitem): def pytest_funcarg__some(self, pyfuncitem):
return pyfuncitem.name return pyfuncitem.name
def pytest_funcarg_other(self, pyfuncitem): def pytest_funcarg__other(self, pyfuncitem):
return 42 return 42
item.config.pytestplugins.register(Provider()) item.config.pytestplugins.register(Provider())
kw = item.lookup_allargs() kw = item.lookup_allargs()
@ -298,7 +298,7 @@ class TestFunction:
item = testdir.getitem("def test_func(some): pass") item = testdir.getitem("def test_func(some): pass")
l = [] l = []
class Provider: class Provider:
def pytest_funcarg_some(self, pyfuncitem): def pytest_funcarg__some(self, pyfuncitem):
pyfuncitem.addfinalizer(lambda: l.append(42)) pyfuncitem.addfinalizer(lambda: l.append(42))
return 3 return 3
item.config.pytestplugins.register(Provider()) item.config.pytestplugins.register(Provider())
@ -312,7 +312,7 @@ class TestFunction:
def test_funcarg_lookup_modulelevel(self, testdir): def test_funcarg_lookup_modulelevel(self, testdir):
modcol = testdir.getmodulecol(""" modcol = testdir.getmodulecol("""
def pytest_funcarg_something(pyfuncitem): def pytest_funcarg__something(pyfuncitem):
return pyfuncitem.name return pyfuncitem.name
class TestClass: class TestClass:

View File

@ -10,7 +10,7 @@ class TestTracebackCutting:
def test_traceback_argsetup(self, testdir): def test_traceback_argsetup(self, testdir):
testdir.makeconftest(""" testdir.makeconftest("""
class ConftestPlugin: class ConftestPlugin:
def pytest_funcarg_hello(self, pyfuncitem): def pytest_funcarg__hello(self, pyfuncitem):
raise ValueError("xyz") raise ValueError("xyz")
""") """)
p = testdir.makepyfile("def test(hello): pass") p = testdir.makepyfile("def test(hello): pass")