Updated error message to be more helpful
Also, added misssing test
This commit is contained in:
parent
699892bd03
commit
99277be25f
|
@ -169,7 +169,7 @@ class MarkGenerator:
|
|||
|
||||
def __getattr__(self, name):
|
||||
if name[0] == "_":
|
||||
raise AttributeError(name)
|
||||
raise AttributeError("Marker name must NOT start with underscore")
|
||||
if hasattr(self, '_config'):
|
||||
self._check(name)
|
||||
return MarkDecorator(name)
|
||||
|
|
|
@ -15,6 +15,10 @@ class TestMark:
|
|||
mark = Mark()
|
||||
pytest.raises((AttributeError, TypeError), mark)
|
||||
|
||||
def test_pytest_mark_name_starts_with_underscore(self):
|
||||
mark = Mark()
|
||||
pytest.raises(AttributeError, getattr, mark, '_some_name')
|
||||
|
||||
def test_pytest_mark_bare(self):
|
||||
mark = Mark()
|
||||
def f():
|
||||
|
|
Loading…
Reference in New Issue