[svn r62974] don't allow "_" in py.test.mark attributes
--HG-- branch : trunk
This commit is contained in:
parent
08b3ac9b1c
commit
e2bbee8bbd
|
@ -161,6 +161,8 @@ class KeywordDecorator:
|
|||
return func
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name[0] == "_":
|
||||
raise AttributeError(name)
|
||||
kw = self._keywords.copy()
|
||||
kw[name] = True
|
||||
return self.__class__(kw, lastname=name)
|
||||
|
|
|
@ -76,8 +76,20 @@ def test_importorskip():
|
|||
print py.code.ExceptionInfo()
|
||||
py.test.fail("spurious skip")
|
||||
|
||||
def test_pytest_mark_getattr():
|
||||
from py.__.test.outcome import mark
|
||||
def f(): pass
|
||||
|
||||
def test_pytest_mark():
|
||||
mark.hello(f)
|
||||
assert f.hello == True
|
||||
|
||||
mark.hello("test")(f)
|
||||
assert f.hello == "test"
|
||||
|
||||
py.test.raises(AttributeError, "mark._hello")
|
||||
py.test.raises(AttributeError, "mark.__str__")
|
||||
|
||||
def test_pytest_mark_call():
|
||||
from py.__.test.outcome import mark
|
||||
def f(): pass
|
||||
mark(x=3)(f)
|
||||
|
|
Loading…
Reference in New Issue