2016-07-23 22:56:04 +08:00
|
|
|
"""
|
|
|
|
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.
|
|
|
|
"""
|
2017-03-17 09:21:30 +08:00
|
|
|
from __future__ import absolute_import, division, print_function
|
2016-07-23 22:56:04 +08:00
|
|
|
|
2017-06-22 21:12:50 +08:00
|
|
|
|
2017-06-23 17:05:38 +08:00
|
|
|
class RemovedInPytest4Warning(DeprecationWarning):
|
|
|
|
"""warning class for features removed in pytest 4.0"""
|
2017-06-22 21:12:50 +08:00
|
|
|
|
|
|
|
|
2016-07-23 22:56:04 +08:00
|
|
|
MAIN_STR_ARGS = 'passing a string to pytest.main() is deprecated, ' \
|
2017-07-17 07:25:07 +08:00
|
|
|
'pass a list of arguments instead.'
|
2016-07-23 22:56:04 +08:00
|
|
|
|
|
|
|
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.')
|
|
|
|
|
2018-03-02 16:28:30 +08:00
|
|
|
CFG_PYTEST_SECTION = '[pytest] section in {filename} files is deprecated, use [tool:pytest] instead.'
|
2016-08-17 08:30:07 +08:00
|
|
|
|
2016-07-23 22:56:04 +08:00
|
|
|
GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue"
|
|
|
|
|
2017-09-01 06:11:20 +08:00
|
|
|
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.'
|
|
|
|
)
|
2017-06-22 21:12:50 +08:00
|
|
|
|
2017-06-23 17:05:38 +08:00
|
|
|
MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
|
2018-05-16 08:35:27 +08:00
|
|
|
"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"
|
2017-06-24 03:06:18 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
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"
|
2017-07-18 08:16:14 +08:00
|
|
|
)
|
2017-10-28 00:34:52 +08:00
|
|
|
|
2017-08-16 19:23:28 +08:00
|
|
|
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.'
|
|
|
|
)
|
|
|
|
|
2017-10-28 00:34:52 +08:00
|
|
|
COLLECTOR_MAKEITEM = RemovedInPytest4Warning(
|
|
|
|
"pycollector makeitem was removed "
|
|
|
|
"as it is an accidentially leaked internal api"
|
2017-10-28 04:42:46 +08:00
|
|
|
)
|
2017-11-15 23:48:08 +08:00
|
|
|
|
|
|
|
METAFUNC_ADD_CALL = (
|
|
|
|
"Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0.\n"
|
|
|
|
"Please use Metafunc.parametrize instead."
|
|
|
|
)
|
2018-02-21 07:27:24 +08:00
|
|
|
|
|
|
|
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."
|
|
|
|
)
|