better name for the oejskit-compatibility-class.

This commit is contained in:
holger krekel 2012-06-25 17:49:13 +02:00
parent 91b6f2bda8
commit b4b86159cd
2 changed files with 19 additions and 19 deletions

View File

@ -496,7 +496,7 @@ def getfuncargnames(function, startindex=None):
def fillfuncargs(node):
""" fill missing funcargs. """
if not isinstance(node, Function):
node = FuncargRequest(pyfuncitem=node)
node = OldFuncargRequest(pyfuncitem=node)
if node.funcargs is None:
node.funcargs = getattr(node, "_funcargs", {})
if not isinstance(node, Function) or not node._isyieldedfunction():
@ -882,7 +882,7 @@ def itemapi_property(name, set=False):
return property(get, set, None, doc)
class FuncargRequest(Request):
class OldFuncargRequest(Request):
""" (deprecated) helper interactions with a test function invocation.
Note that there is an optional ``param`` attribute in case
@ -901,7 +901,7 @@ class FuncargRequest(Request):
pass
def __repr__(self):
return "<FuncargRequest for %r>" % (self._pyfuncitem.name)
return "<OldFuncargRequest for %r>" % (self._pyfuncitem.name)
_getscopeitem = itemapi_property("_getscopeitem")
funcargs = itemapi_property("funcargs", set=True)

View File

@ -549,7 +549,7 @@ class TestFillFuncArgs:
return 42
""")
item = testdir.getitem("def test_func(some): pass")
exc = pytest.raises(funcargs.FuncargRequest.LookupError,
exc = pytest.raises(funcargs.OldFuncargRequest.LookupError,
"funcargs.fillfuncargs(item)")
s = str(exc.value)
assert s.find("xyzsomething") != -1
@ -624,7 +624,7 @@ class TestRequest:
def pytest_funcarg__something(request): pass
def test_func(something): pass
""")
req = funcargs.FuncargRequest(item)
req = funcargs.OldFuncargRequest(item)
assert req.function == item.obj
assert req.keywords is item.keywords
assert hasattr(req.module, 'test_func')
@ -639,7 +639,7 @@ class TestRequest:
def test_func(self, something):
pass
""")
req = funcargs.FuncargRequest(item)
req = funcargs.OldFuncargRequest(item)
assert req.cls.__name__ == "TestB"
assert req.instance.__class__ == req.cls
@ -653,7 +653,7 @@ class TestRequest:
""")
item1, = testdir.genitems([modcol])
assert item1.name == "test_method"
name2factory = funcargs.FuncargRequest(item1)._name2factory
name2factory = funcargs.OldFuncargRequest(item1)._name2factory
assert len(name2factory) == 1
assert name2factory[0].__name__ == "pytest_funcarg__something"
@ -668,7 +668,7 @@ class TestRequest:
def test_func(something):
assert something == 2
""")
req = funcargs.FuncargRequest(item)
req = funcargs.OldFuncargRequest(item)
val = req.getfuncargvalue("something")
assert val == 2
@ -680,7 +680,7 @@ class TestRequest:
return l.pop()
def test_func(something): pass
""")
req = funcargs.FuncargRequest(item)
req = funcargs.OldFuncargRequest(item)
pytest.raises(req.LookupError, req.getfuncargvalue, "notexists")
val = req.getfuncargvalue("something")
assert val == 1
@ -728,7 +728,7 @@ class TestRequest:
def test_request_getmodulepath(self, testdir):
modcol = testdir.getmodulecol("def test_somefunc(): pass")
item, = testdir.genitems([modcol])
req = funcargs.FuncargRequest(item)
req = funcargs.OldFuncargRequest(item)
assert req.fspath == modcol.fspath
def test_applymarker(testdir):
@ -739,7 +739,7 @@ def test_applymarker(testdir):
def test_func2(self, something):
pass
""")
req1 = funcargs.FuncargRequest(item1)
req1 = funcargs.OldFuncargRequest(item1)
assert 'xfail' not in item1.keywords
req1.applymarker(pytest.mark.xfail)
assert 'xfail' in item1.keywords
@ -757,7 +757,7 @@ class TestRequestCachedSetup:
def test_func2(self, something):
pass
""")
req1 = funcargs.FuncargRequest(item1)
req1 = funcargs.OldFuncargRequest(item1)
l = ["hello"]
def setup():
return l.pop()
@ -766,7 +766,7 @@ class TestRequestCachedSetup:
assert ret1 == "hello"
ret1b = req1.cached_setup(setup)
assert ret1 == ret1b
req2 = funcargs.FuncargRequest(item2)
req2 = funcargs.OldFuncargRequest(item2)
ret2 = req2.cached_setup(setup)
assert ret2 == ret1
@ -782,7 +782,7 @@ class TestRequestCachedSetup:
def test_func2b(self, something):
pass
""")
req1 = funcargs.FuncargRequest(item2)
req1 = funcargs.OldFuncargRequest(item2)
l = ["hello2", "hello"]
def setup():
return l.pop()
@ -791,22 +791,22 @@ class TestRequestCachedSetup:
# automatically turn "class" to "module" scope
ret1 = req1.cached_setup(setup, scope="class")
assert ret1 == "hello"
req2 = funcargs.FuncargRequest(item2)
req2 = funcargs.OldFuncargRequest(item2)
ret2 = req2.cached_setup(setup, scope="class")
assert ret2 == "hello"
req3 = funcargs.FuncargRequest(item3)
req3 = funcargs.OldFuncargRequest(item3)
ret3a = req3.cached_setup(setup, scope="class")
ret3b = req3.cached_setup(setup, scope="class")
assert ret3a == "hello2"
assert ret3b == "hello2"
req4 = funcargs.FuncargRequest(item4)
req4 = funcargs.OldFuncargRequest(item4)
ret4 = req4.cached_setup(setup, scope="class")
assert ret4 == ret3a
def test_request_cachedsetup_extrakey(self, testdir):
item1 = testdir.getitem("def test_func(): pass")
req1 = funcargs.FuncargRequest(item1)
req1 = funcargs.OldFuncargRequest(item1)
l = ["hello", "world"]
def setup():
return l.pop()
@ -821,7 +821,7 @@ class TestRequestCachedSetup:
def test_request_cachedsetup_cache_deletion(self, testdir):
item1 = testdir.getitem("def test_func(): pass")
req1 = funcargs.FuncargRequest(item1)
req1 = funcargs.OldFuncargRequest(item1)
l = []
def setup():
l.append("setup")