introduce deprecation warnings for legacy parametersets, fixes #2427
This commit is contained in:
parent
bab18e10eb
commit
0d0b01bded
|
@ -31,3 +31,9 @@ RESULT_LOG = '--result-log is deprecated and scheduled for removal in pytest 4.0
|
||||||
MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
|
MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
|
||||||
"MarkInfo objects are deprecated as they contain the merged marks"
|
"MarkInfo objects are deprecated as they contain the merged marks"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
MARK_PARAMETERSET_UNPACKING = RemovedInPytest4Warning(
|
||||||
|
"Applying marks directly to parameters is deprecated,"
|
||||||
|
" please use pytest.param(..., marks=...) instead.\n"
|
||||||
|
"For more details, see: https://docs.pytest.org/en/latest/parametrize.html"
|
||||||
|
)
|
|
@ -6,7 +6,7 @@ import warnings
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from .compat import imap
|
from .compat import imap
|
||||||
from .deprecated import MARK_INFO_ATTRIBUTE
|
from .deprecated import MARK_INFO_ATTRIBUTE, MARK_PARAMETERSET_UNPACKING
|
||||||
|
|
||||||
def alias(name, warning=None):
|
def alias(name, warning=None):
|
||||||
getter = attrgetter(name)
|
getter = attrgetter(name)
|
||||||
|
@ -61,6 +61,9 @@ class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')):
|
||||||
if legacy_force_tuple:
|
if legacy_force_tuple:
|
||||||
argval = argval,
|
argval = argval,
|
||||||
|
|
||||||
|
if newmarks:
|
||||||
|
warnings.warn(MARK_PARAMETERSET_UNPACKING)
|
||||||
|
|
||||||
return cls(argval, marks=newmarks, id=None)
|
return cls(argval, marks=newmarks, id=None)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
introduce deprecation warnings for legacy marks based parametersets
|
Loading…
Reference in New Issue