Merge pull request #9 from lukaszb/mark-error-message
Updated error message to be more helpful.
This commit is contained in:
commit
49b9f9091a
|
@ -169,7 +169,7 @@ class MarkGenerator:
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
if name[0] == "_":
|
if name[0] == "_":
|
||||||
raise AttributeError(name)
|
raise AttributeError("Marker name must NOT start with underscore")
|
||||||
if hasattr(self, '_config'):
|
if hasattr(self, '_config'):
|
||||||
self._check(name)
|
self._check(name)
|
||||||
return MarkDecorator(name)
|
return MarkDecorator(name)
|
||||||
|
|
|
@ -15,6 +15,10 @@ class TestMark:
|
||||||
mark = Mark()
|
mark = Mark()
|
||||||
pytest.raises((AttributeError, TypeError), 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):
|
def test_pytest_mark_bare(self):
|
||||||
mark = Mark()
|
mark = Mark()
|
||||||
def f():
|
def f():
|
||||||
|
|
Loading…
Reference in New Issue