- add request.node which maps to the collection node as specified by the scope.
- remove request.markers which is now available via request.node.markers
This commit is contained in:
parent
c2480f5c54
commit
631d311e89
|
@ -1,9 +1,11 @@
|
|||
Changes between 2.2.4 and 2.3.0.dev
|
||||
-----------------------------------
|
||||
|
||||
- introduce a generic "markers" object on Nodes and request objects
|
||||
to allow for reading and manipulation of MarkInfo objects previously
|
||||
set with calls to pytest.mark.* classes.
|
||||
- introduce a generic "markers" object on Nodes and a request.node
|
||||
attribute pointing to the scope-specific collection node of a request.
|
||||
node.markers allows reading and manipulating of MarkInfo objects
|
||||
previously attached with @pytest.mark.* or request.applymarker or
|
||||
setattr(node.markers, name, pytest.mark.*) calls.
|
||||
- fix issue185 monkeypatching time.time does not cause pytest to fail
|
||||
- fix issue172 duplicate call of pytest.setup-decoratored setup_module
|
||||
functions
|
||||
|
|
|
@ -962,8 +962,9 @@ class FuncargRequest:
|
|||
self._factorystack = []
|
||||
|
||||
@property
|
||||
def markers(self):
|
||||
return self._getscopeitem(self.scope).markers
|
||||
def node(self):
|
||||
""" underlying collection node (depends on request scope)"""
|
||||
return self._getscopeitem(self.scope)
|
||||
|
||||
def _getfaclist(self, argname):
|
||||
facdeflist = self._name2factory.get(argname, None)
|
||||
|
@ -1017,7 +1018,7 @@ class FuncargRequest:
|
|||
|
||||
@property
|
||||
def keywords(self):
|
||||
""" dictionary of markers (readonly). """
|
||||
""" (deprecated, use node.markers class) dictionary of markers. """
|
||||
return self._pyfuncitem.keywords
|
||||
|
||||
@property
|
||||
|
@ -1051,8 +1052,7 @@ class FuncargRequest:
|
|||
"""
|
||||
if not isinstance(marker, py.test.mark.XYZ.__class__):
|
||||
raise ValueError("%r is not a py.test.mark.* object")
|
||||
setattr(self.markers, marker.markname, marker)
|
||||
#self._pyfuncitem.keywords[marker.markname] = marker
|
||||
setattr(self.node.markers, marker.markname, marker)
|
||||
|
||||
def raiseerror(self, msg):
|
||||
""" raise a FuncargLookupError with the given message. """
|
||||
|
|
|
@ -741,7 +741,7 @@ class TestMarking:
|
|||
import pytest
|
||||
@pytest.factory()
|
||||
def markers(request):
|
||||
return request.markers
|
||||
return request.node.markers
|
||||
@pytest.mark.XYZ
|
||||
def test_function(markers):
|
||||
assert markers.XYZ is not None
|
||||
|
@ -755,7 +755,7 @@ class TestMarking:
|
|||
import pytest
|
||||
@pytest.factory()
|
||||
def markers(request):
|
||||
return request.markers
|
||||
return request.node.markers
|
||||
|
||||
@pytest.setup(scope="class")
|
||||
def marking(request):
|
||||
|
|
Loading…
Reference in New Issue