Updated error message to be more helpful

Also, added misssing test
This commit is contained in:
Lukasz Balcerzak 2013-12-19 14:29:57 +01:00
parent 699892bd03
commit 99277be25f
2 changed files with 5 additions and 1 deletions

View File

@ -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)

View File

@ -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():