summaryrefslogtreecommitdiffstats
path: root/third_party/python/pytest/src/_pytest/deprecated.py
blob: 7ebdcf9997222c20d3bd07f70692f88de5ed144a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
This module contains deprecation messages and bits of code used elsewhere in the codebase
that is planned to be removed in the next pytest release.

Keeping it in a central location makes it easy to track what is deprecated and should
be removed when the time comes.
"""
from __future__ import absolute_import, division, print_function


class RemovedInPytest4Warning(DeprecationWarning):
    """warning class for features removed in pytest 4.0"""


MAIN_STR_ARGS = "passing a string to pytest.main() is deprecated, " "pass a list of arguments instead."

YIELD_TESTS = "yield tests are deprecated, and scheduled to be removed in pytest 4.0"

FUNCARG_PREFIX = (
    '{name}: declaring fixtures using "pytest_funcarg__" prefix is deprecated '
    "and scheduled to be removed in pytest 4.0.  "
    "Please remove the prefix and use the @pytest.fixture decorator instead."
)

CFG_PYTEST_SECTION = "[pytest] section in {filename} files is deprecated, use [tool:pytest] instead."

GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue"

RESULT_LOG = (
    "--result-log is deprecated and scheduled for removal in pytest 4.0.\n"
    "See https://docs.pytest.org/en/latest/usage.html#creating-resultlog-format-files for more information."
)

MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
    "MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly.\n"
    "Please use node.get_closest_marker(name) or node.iter_markers(name).\n"
    "Docs: https://docs.pytest.org/en/latest/mark.html#updating-code"
)

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"
)

RECORD_XML_PROPERTY = (
    'Fixture renamed from "record_xml_property" to "record_property" as user '
    "properties are now available to all reporters.\n"
    '"record_xml_property" is now deprecated.'
)

COLLECTOR_MAKEITEM = RemovedInPytest4Warning(
    "pycollector makeitem was removed " "as it is an accidentially leaked internal api"
)

METAFUNC_ADD_CALL = (
    "Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0.\n"
    "Please use Metafunc.parametrize instead."
)

PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST = RemovedInPytest4Warning(
    "Defining pytest_plugins in a non-top-level conftest is deprecated, "
    "because it affects the entire directory tree in a non-explicit way.\n"
    "Please move it to the top level conftest file instead."
)