Skip to content
Permalink
Browse files

fix pytest-dev#3631 - don't store legacy markinfo when its impossible

  • Loading branch information...
RonnyPfannschmidt committed Jun 29, 2018
1 parent 8680dfc commit 934ca13488b85ff7c2eece71df52758d07ffb42c
Showing with 15 additions and 1 deletion.
  1. +1 −0 changelog/3631.bugfix.rst
  2. +1 −1 src/_pytest/mark/structures.py
  3. +13 −0 testing/test_mark.py
@@ -0,0 +1 @@
No longer raise AttributeError when legacy marks can't be stored.
@@ -259,7 +259,7 @@ def store_legacy_markinfo(func, mark):
if holder is None:
holder = MarkInfo.for_mark(mark)
setattr(func, mark.name, holder)
else:
elif isinstance(holder, MarkInfo):
holder.add_mark(mark)


@@ -63,6 +63,19 @@ def f():
mark.hello(f)
assert f.hello

def test_mark_legacy_ignore_fail(self):
def add_attribute(func):
func.foo = 1
return func

@pytest.mark.foo
@add_attribute
def test_fun():
pass

assert test_fun.foo == 1
assert test_fun.pytestmark

@ignore_markinfo
def test_pytest_mark_keywords(self):
mark = Mark()

0 comments on commit 934ca13

Please sign in to comment.
You can’t perform that action at this time.