parent
64ae6ae25d
commit
19b12b22e7
|
@ -333,6 +333,7 @@ class MarkDecorator:
|
||||||
apply_mark(func, self.mark)
|
apply_mark(func, self.mark)
|
||||||
else:
|
else:
|
||||||
apply_legacy_mark(func, self.mark)
|
apply_legacy_mark(func, self.mark)
|
||||||
|
apply_mark(func, self.mark)
|
||||||
return func
|
return func
|
||||||
|
|
||||||
mark = Mark(self.name, args, kwargs)
|
mark = Mark(self.name, args, kwargs)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest.mark import MarkGenerator as Mark, ParameterSet
|
from _pytest.mark import MarkGenerator as Mark, ParameterSet, transfer_markers
|
||||||
|
|
||||||
class TestMark(object):
|
class TestMark(object):
|
||||||
def test_markinfo_repr(self):
|
def test_markinfo_repr(self):
|
||||||
|
@ -772,3 +772,25 @@ class TestKeywordSelection(object):
|
||||||
def test_parameterset_extractfrom(argval, expected):
|
def test_parameterset_extractfrom(argval, expected):
|
||||||
extracted = ParameterSet.extract_from(argval)
|
extracted = ParameterSet.extract_from(argval)
|
||||||
assert extracted == expected
|
assert extracted == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_legacy_transfer():
|
||||||
|
|
||||||
|
class FakeModule(object):
|
||||||
|
pytestmark = []
|
||||||
|
|
||||||
|
class FakeClass(object):
|
||||||
|
pytestmark = pytest.mark.nofun
|
||||||
|
|
||||||
|
@pytest.mark.fun
|
||||||
|
def fake_method(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
transfer_markers(fake_method, FakeClass, FakeModule)
|
||||||
|
|
||||||
|
# legacy marks transfer smeared
|
||||||
|
assert fake_method.nofun
|
||||||
|
assert fake_method.fun
|
||||||
|
# pristine marks dont transfer
|
||||||
|
assert fake_method.pytestmark == [pytest.mark.fun.mark]
|
Loading…
Reference in New Issue