[svn r63338] rename pyfuncarg to funcarg
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									ee902a2d06
								
							
						
					
					
						commit
						8230a39b39
					
				|  | @ -3,9 +3,9 @@ rsyncignore = ['c-extension/greenlet/build'] | ||||||
| 
 | 
 | ||||||
| import py | import py | ||||||
| class PylibTestconfigPlugin: | class PylibTestconfigPlugin: | ||||||
|     def pytest_pyfuncarg_specssh(self, pyfuncitem): |     def pytest_funcarg_specssh(self, pyfuncitem): | ||||||
|         return getspecssh(pyfuncitem.config) |         return getspecssh(pyfuncitem.config) | ||||||
|     def pytest_pyfuncarg_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): | ||||||
|  |  | ||||||
|  | @ -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_pyfuncarg_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_pyfuncarg_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: | ||||||
|  |  | ||||||
|  | @ -7,9 +7,9 @@ from py.__.test.dist.nodemanage import NodeManager | ||||||
| 
 | 
 | ||||||
| from py.__.test import event | from py.__.test import event | ||||||
| 
 | 
 | ||||||
| def pytest_pyfuncarg_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_pyfuncarg_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  | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -54,12 +54,12 @@ class MySetup: | ||||||
|             print "exiting:", gw |             print "exiting:", gw | ||||||
|             gw.exit() |             gw.exit() | ||||||
| 
 | 
 | ||||||
| def pytest_pyfuncarg_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_pyfuncarg_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() | ||||||
|  |  | ||||||
|  | @ -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_pyfuncarg_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_pyfuncarg_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  | ||||||
|  |  | ||||||
|  | @ -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_pyfuncarg_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_pyfuncarg_") |             return name.startswith("pytest_funcarg_") | ||||||
| 
 | 
 | ||||||
|         while methods: |         while methods: | ||||||
|             name, method = methods.popitem() |             name, method = methods.popitem() | ||||||
|  |  | ||||||
|  | @ -328,7 +328,7 @@ class TestApigenLinkRole: | ||||||
|                        "resolve_linkrole('source', 'py/foo/bar.py')") |                        "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 = __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()) | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ class TmpdirPlugin: | ||||||
|     """ provide temporary directories to test functions and methods.  |     """ provide temporary directories to test functions and methods.  | ||||||
|     """  |     """  | ||||||
| 
 | 
 | ||||||
|     def pytest_pyfuncarg_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) | ||||||
| 
 | 
 | ||||||
|  | @ -26,10 +26,10 @@ class TmpdirPlugin: | ||||||
| def test_generic(plugintester): | def test_generic(plugintester): | ||||||
|     plugintester.apicheck(TmpdirPlugin) |     plugintester.apicheck(TmpdirPlugin) | ||||||
| 
 | 
 | ||||||
| def test_pyfuncarg(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_pyfuncarg_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") | ||||||
|  |  | ||||||
|  | @ -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_pyfuncarg_" |         prefix = "pytest_funcarg_" | ||||||
|         try: |         try: | ||||||
|             makerlist = self.config._getmakerlist(argname) |             makerlist = self.config._getmakerlist(argname) | ||||||
|         except KeyError: |         except KeyError: | ||||||
|  | @ -390,7 +390,7 @@ class Function(FunctionMixin, py.test.collect.Item): | ||||||
|         else: |         else: | ||||||
|             self._raisefuncargerror(argname, prefix) |             self._raisefuncargerror(argname, prefix) | ||||||
| 
 | 
 | ||||||
|     def _raisefuncargerror(self, argname, prefix="pytest_pyfuncarg_"): |     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() | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| import py | import py | ||||||
| 
 | 
 | ||||||
| def pytest_pyfuncarg_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): | ||||||
|  |  | ||||||
|  | @ -249,10 +249,10 @@ class TestFunction: | ||||||
|         assert f1 == f1_b |         assert f1 == f1_b | ||||||
|         assert not f1 != f1_b |         assert not f1 != f1_b | ||||||
| 
 | 
 | ||||||
|     def test_pyfuncarg_lookupfails(self, testdir): |     def test_funcarg_lookupfails(self, testdir): | ||||||
|         testdir.makeconftest(""" |         testdir.makeconftest(""" | ||||||
|             class ConftestPlugin: |             class ConftestPlugin: | ||||||
|                 def pytest_pyfuncarg_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") | ||||||
|  | @ -260,19 +260,19 @@ class TestFunction: | ||||||
|         s = str(exc.value) |         s = str(exc.value) | ||||||
|         assert s.find("something") != -1 |         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") |         item = testdir.getitem("def test_func(some, other=42): pass") | ||||||
|         class Provider: |         class Provider: | ||||||
|             def pytest_pyfuncarg_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() | ||||||
|         assert len(kw) == 1 |         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") |         item = testdir.getitem("def test_func(some=42, other=13): pass") | ||||||
|         class Provider: |         class Provider: | ||||||
|             def pytest_pyfuncarg_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() | ||||||
|  | @ -281,12 +281,12 @@ class TestFunction: | ||||||
|         assert name == "other" |         assert name == "other" | ||||||
|         assert value == item.name  |         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") |         item = testdir.getitem("def test_func(some, other): pass") | ||||||
|         class Provider: |         class Provider: | ||||||
|             def pytest_pyfuncarg_some(self, pyfuncitem): |             def pytest_funcarg_some(self, pyfuncitem): | ||||||
|                 return pyfuncitem.name  |                 return pyfuncitem.name  | ||||||
|             def pytest_pyfuncarg_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() | ||||||
|  | @ -294,11 +294,11 @@ class TestFunction: | ||||||
|         assert kw['some'] == "test_func" |         assert kw['some'] == "test_func" | ||||||
|         assert kw['other'] == 42 |         assert kw['other'] == 42 | ||||||
| 
 | 
 | ||||||
|     def test_pyfuncarg_addfinalizer(self, testdir): |     def test_funcarg_addfinalizer(self, testdir): | ||||||
|         item = testdir.getitem("def test_func(some): pass") |         item = testdir.getitem("def test_func(some): pass") | ||||||
|         l = [] |         l = [] | ||||||
|         class Provider: |         class Provider: | ||||||
|             def pytest_pyfuncarg_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()) | ||||||
|  | @ -310,9 +310,9 @@ class TestFunction: | ||||||
|         assert len(l) == 1 |         assert len(l) == 1 | ||||||
|         assert l[0] == 42 |         assert l[0] == 42 | ||||||
| 
 | 
 | ||||||
|     def test_pyfuncarg_lookup_modulelevel(self, testdir): |     def test_funcarg_lookup_modulelevel(self, testdir): | ||||||
|         modcol = testdir.getmodulecol(""" |         modcol = testdir.getmodulecol(""" | ||||||
|             def pytest_pyfuncarg_something(pyfuncitem): |             def pytest_funcarg_something(pyfuncitem): | ||||||
|                 return pyfuncitem.name |                 return pyfuncitem.name | ||||||
| 
 | 
 | ||||||
|             class TestClass: |             class TestClass: | ||||||
|  |  | ||||||
|  | @ -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_pyfuncarg_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") | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue