[py-svn] commit/pytest: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Mon Jun 25 18:08:19 CEST 2012
2 new commits in pytest:
https://bitbucket.org/hpk42/pytest/changeset/a01438c16511/
changeset: a01438c16511
user: hpk42
date: 2012-06-25 17:49:13
summary: better name for the oejskit-compatibility-class.
affected #: 2 files
diff -r c529c3593197291538b5b55f59dd1da608433e6c -r a01438c16511c56cdc6c608f5327901094ae509b _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -496,7 +496,7 @@
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 @@
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 @@
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)
diff -r c529c3593197291538b5b55f59dd1da608433e6c -r a01438c16511c56cdc6c608f5327901094ae509b testing/test_python.py
--- a/testing/test_python.py
+++ b/testing/test_python.py
@@ -549,7 +549,7 @@
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 @@
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 @@
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 @@
""")
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 @@
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 @@
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 @@
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_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 @@
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 @@
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 @@
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 @@
# 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 @@
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")
https://bitbucket.org/hpk42/pytest/changeset/6c84905dcbf3/
changeset: 6c84905dcbf3
user: hpk42
date: 2012-06-25 18:08:12
summary: fix issue139 - make it possible to access funcargs from pytest_runtest_setup
affected #: 1 file
diff -r a01438c16511c56cdc6c608f5327901094ae509b -r 6c84905dcbf31ab327ca02491013208a2effd525 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,11 +1,11 @@
Changes between 2.2.4 and 2.3.0.dev
-----------------------------------
-- merge FuncargRequest and Item API such that funcarg-functionality
- is now natively available on the "item" object passed to the various
- pytest_runtest hooks. This allows more sensitive behaviour
- of e.g. the pytest-django plugin which previously had no full
- access to all instantiated funcargs.
+- fix issue139 - merge FuncargRequest and Item API such that
+ funcarg-functionality is now directly available on the "item"
+ object passed to the various pytest_runtest hooks. This allows more
+ sensitive behaviour of e.g. the pytest-django plugin which previously
+ had no full access to all instantiated funcargs.
This internal API re-organisation is a fully backward compatible
change: existing factories accepting a "request" object will
get a Function "item" object which carries the same API. In fact,
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list