Skip to content

Commit

Permalink
Merge pull request #2524 from RonnyPfannschmidt/fix-2427
Browse files Browse the repository at this point in the history
introduce deprecation warnings for legacy parametersets, fixes #2427
  • Loading branch information
nicoddemus authored Jun 24, 2017
2 parents bab18e1 + 0d0b01b commit 1906f8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions _pytest/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ class RemovedInPytest4Warning(DeprecationWarning):

MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
"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"
)
5 changes: 4 additions & 1 deletion _pytest/mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import namedtuple
from operator import attrgetter
from .compat import imap
from .deprecated import MARK_INFO_ATTRIBUTE
from .deprecated import MARK_INFO_ATTRIBUTE, MARK_PARAMETERSET_UNPACKING

def alias(name, warning=None):
getter = attrgetter(name)
Expand Down Expand Up @@ -61,6 +61,9 @@ def extract_from(cls, parameterset, legacy_force_tuple=False):
if legacy_force_tuple:
argval = argval,

if newmarks:
warnings.warn(MARK_PARAMETERSET_UNPACKING)

return cls(argval, marks=newmarks, id=None)

@property
Expand Down
1 change: 1 addition & 0 deletions changelog/2427.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
introduce deprecation warnings for legacy marks based parametersets

0 comments on commit 1906f8c

Please sign in to comment.