From 7b354050335caaf8316cf5cf17d45af64649dbb1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 30 Jun 2019 12:28:40 -0300 Subject: [PATCH] Remove YIELD_TESTS from deprecated module as it is now an error --- src/_pytest/deprecated.py | 2 -- src/_pytest/python.py | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index 58ffee1ae..fff7af2f9 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -10,8 +10,6 @@ in case of warnings which need to format their messages. """ from _pytest.warning_types import PytestDeprecationWarning -YIELD_TESTS = "yield tests were removed in pytest 4.0 - {name} will be ignored" - # set of plugins which have been integrated into the core; we use this list to ignore # them during registration to avoid conflicts DEPRECATED_EXTERNAL_PLUGINS = { diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 66d853060..801a16a5c 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -12,7 +12,6 @@ from textwrap import dedent import py import _pytest -from _pytest import deprecated from _pytest import fixtures from _pytest import nodes from _pytest._code import filter_traceback @@ -218,7 +217,9 @@ def pytest_pycollect_makeitem(collector, name, obj): elif getattr(obj, "__test__", True): if is_generator(obj): res = Function(name, parent=collector) - reason = deprecated.YIELD_TESTS.format(name=name) + reason = "yield tests were removed in pytest 4.0 - {name} will be ignored".format( + name=name + ) res.add_marker(MARK_GEN.xfail(run=False, reason=reason)) res.warn(PytestCollectionWarning(reason)) else: