[svn r63338] rename pyfuncarg to funcarg

--HG--
branch : trunk
This commit is contained in:
hpk 2009-03-26 10:16:30 +01:00
parent ee902a2d06
commit 8230a39b39
12 changed files with 33 additions and 33 deletions

View File

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

View File

@ -111,9 +111,9 @@ class TestGatewayManagerPopen:
assert l[0].startswith(curwd)
assert l[0].endswith("hello")
def pytest_pyfuncarg_source(pyfuncitem):
def pytest_funcarg_source(pyfuncitem):
return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("source")
def pytest_pyfuncarg_dest(pyfuncitem):
def pytest_funcarg_dest(pyfuncitem):
return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("dest")
class TestHRSync:

View File

@ -7,9 +7,9 @@ from py.__.test.dist.nodemanage import NodeManager
from py.__.test import event
def pytest_pyfuncarg_source(pyfuncitem):
def pytest_funcarg_source(pyfuncitem):
return py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("source")
def pytest_pyfuncarg_dest(pyfuncitem):
def pytest_funcarg_dest(pyfuncitem):
dest = py.test.ensuretemp(pyfuncitem.getmodpath()).mkdir("dest")
return dest

View File

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

View File

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

View File

@ -5,7 +5,7 @@ import py
class PlugintesterPlugin:
""" test support code for testing pytest plugins. """
def pytest_pyfuncarg_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_pyfuncarg_")
return name.startswith("pytest_funcarg_")
while methods:
name, method = methods.popitem()

View File

@ -328,7 +328,7 @@ class TestApigenLinkRole:
"resolve_linkrole('source', 'py/foo/bar.py')")
def pytest_pyfuncarg_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())

View File

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

View File

@ -375,7 +375,7 @@ class Function(FunctionMixin, py.test.collect.Item):
return kwargs
def lookup_onearg(self, argname):
prefix = "pytest_pyfuncarg_"
prefix = "pytest_funcarg_"
try:
makerlist = self.config._getmakerlist(argname)
except KeyError:
@ -390,7 +390,7 @@ class Function(FunctionMixin, py.test.collect.Item):
else:
self._raisefuncargerror(argname, prefix)
def _raisefuncargerror(self, argname, prefix="pytest_pyfuncarg_"):
def _raisefuncargerror(self, argname, prefix="pytest_funcarg_"):
metainfo = self.repr_metainfo()
available = []
plugins = self.config.pytestplugins._plugins.values()

View File

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

View File

@ -249,10 +249,10 @@ class TestFunction:
assert f1 == f1_b
assert not f1 != f1_b
def test_pyfuncarg_lookupfails(self, testdir):
def test_funcarg_lookupfails(self, testdir):
testdir.makeconftest("""
class ConftestPlugin:
def pytest_pyfuncarg_something(self, pyfuncitem):
def pytest_funcarg_something(self, pyfuncitem):
return 42
""")
item = testdir.getitem("def test_func(some): pass")
@ -260,19 +260,19 @@ class TestFunction:
s = str(exc.value)
assert s.find("something") != -1
def test_pyfuncarg_lookup_default(self, testdir):
def test_funcarg_lookup_default(self, testdir):
item = testdir.getitem("def test_func(some, other=42): pass")
class Provider:
def pytest_pyfuncarg_some(self, pyfuncitem):
def pytest_funcarg_some(self, pyfuncitem):
return pyfuncitem.name
item.config.pytestplugins.register(Provider())
kw = item.lookup_allargs()
assert len(kw) == 1
def test_pyfuncarg_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")
class Provider:
def pytest_pyfuncarg_other(self, pyfuncitem):
def pytest_funcarg_other(self, pyfuncitem):
return pyfuncitem.name
item.config.pytestplugins.register(Provider())
kw = item.lookup_allargs()
@ -281,12 +281,12 @@ class TestFunction:
assert name == "other"
assert value == item.name
def test_pyfuncarg_basic(self, testdir):
def test_funcarg_basic(self, testdir):
item = testdir.getitem("def test_func(some, other): pass")
class Provider:
def pytest_pyfuncarg_some(self, pyfuncitem):
def pytest_funcarg_some(self, pyfuncitem):
return pyfuncitem.name
def pytest_pyfuncarg_other(self, pyfuncitem):
def pytest_funcarg_other(self, pyfuncitem):
return 42
item.config.pytestplugins.register(Provider())
kw = item.lookup_allargs()
@ -294,11 +294,11 @@ class TestFunction:
assert kw['some'] == "test_func"
assert kw['other'] == 42
def test_pyfuncarg_addfinalizer(self, testdir):
def test_funcarg_addfinalizer(self, testdir):
item = testdir.getitem("def test_func(some): pass")
l = []
class Provider:
def pytest_pyfuncarg_some(self, pyfuncitem):
def pytest_funcarg_some(self, pyfuncitem):
pyfuncitem.addfinalizer(lambda: l.append(42))
return 3
item.config.pytestplugins.register(Provider())
@ -310,9 +310,9 @@ class TestFunction:
assert len(l) == 1
assert l[0] == 42
def test_pyfuncarg_lookup_modulelevel(self, testdir):
def test_funcarg_lookup_modulelevel(self, testdir):
modcol = testdir.getmodulecol("""
def pytest_pyfuncarg_something(pyfuncitem):
def pytest_funcarg_something(pyfuncitem):
return pyfuncitem.name
class TestClass:

View File

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