diff options
author | Maximilian Cosmo Sitter <48606431+mcsitter@users.noreply.github.com> | 2020-08-22 16:17:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-22 11:17:50 -0300 |
commit | 75af2bfa06436752165df884d4666402529b1d6a (patch) | |
tree | c8a1de5b68e4adbc39142cef96e42111f61c6a43 /src | |
parent | d69abff2c7de8bc65b7f1ef867dec5b5b9c564bd (diff) | |
download | pytest-75af2bfa06436752165df884d4666402529b1d6a.tar.gz |
Reintroduce warnings postponed in 6.0 (#7637)
Diffstat (limited to 'src')
-rw-r--r-- | src/_pytest/fixtures.py | 5 | ||||
-rw-r--r-- | src/_pytest/hookspec.py | 5 | ||||
-rw-r--r-- | src/_pytest/mark/__init__.py | 9 | ||||
-rw-r--r-- | src/pytest/collect.py | 6 |
4 files changed, 13 insertions, 12 deletions
diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 03d8f5394..47a7ac225 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -2,6 +2,7 @@ import functools import inspect import os import sys +import warnings from collections import defaultdict from collections import deque from types import TracebackType @@ -45,6 +46,7 @@ from _pytest.compat import TYPE_CHECKING from _pytest.config import _PluggyPlugin from _pytest.config import Config from _pytest.config.argparsing import Parser +from _pytest.deprecated import FILLFUNCARGS from _pytest.mark import ParameterSet from _pytest.outcomes import fail from _pytest.outcomes import TEST_OUTCOME @@ -359,8 +361,7 @@ def reorder_items_atscope( def fillfixtures(function: "Function") -> None: """Fill missing funcargs for a test function.""" - # Uncomment this after 6.0 release (#7361) - # warnings.warn(FILLFUNCARGS, stacklevel=2) + warnings.warn(FILLFUNCARGS, stacklevel=2) try: request = function._request except AttributeError: diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index e60bfe9f9..1906a3598 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -13,6 +13,7 @@ import py.path from pluggy import HookspecMarker from _pytest.compat import TYPE_CHECKING +from _pytest.deprecated import WARNING_CAPTURED_HOOK if TYPE_CHECKING: import pdb @@ -723,9 +724,7 @@ def pytest_terminal_summary( """ -# Uncomment this after 6.0 release (#7361) -# @hookspec(historic=True, warn_on_impl=WARNING_CAPTURED_HOOK) -@hookspec(historic=True) +@hookspec(historic=True, warn_on_impl=WARNING_CAPTURED_HOOK) def pytest_warning_captured( warning_message: "warnings.WarningMessage", when: "Literal['config', 'collect', 'runtest']", diff --git a/src/_pytest/mark/__init__.py b/src/_pytest/mark/__init__.py index d677d49c1..6a9b26230 100644 --- a/src/_pytest/mark/__init__.py +++ b/src/_pytest/mark/__init__.py @@ -1,5 +1,6 @@ """Generic mechanism for marking and selecting python functions.""" import typing +import warnings from typing import AbstractSet from typing import List from typing import Optional @@ -22,6 +23,8 @@ from _pytest.config import ExitCode from _pytest.config import hookimpl from _pytest.config import UsageError from _pytest.config.argparsing import Parser +from _pytest.deprecated import MINUS_K_COLON +from _pytest.deprecated import MINUS_K_DASH from _pytest.store import StoreKey if TYPE_CHECKING: @@ -185,14 +188,12 @@ def deselect_by_keyword(items: "List[Item]", config: Config) -> None: if keywordexpr.startswith("-"): # To be removed in pytest 7.0.0. - # Uncomment this after 6.0 release (#7361) - # warnings.warn(MINUS_K_DASH, stacklevel=2) + warnings.warn(MINUS_K_DASH, stacklevel=2) keywordexpr = "not " + keywordexpr[1:] selectuntil = False if keywordexpr[-1:] == ":": # To be removed in pytest 7.0.0. - # Uncomment this after 6.0 release (#7361) - # warnings.warn(MINUS_K_COLON, stacklevel=2) + warnings.warn(MINUS_K_COLON, stacklevel=2) selectuntil = True keywordexpr = keywordexpr[:-1] diff --git a/src/pytest/collect.py b/src/pytest/collect.py index 55b4b9b35..2edf4470f 100644 --- a/src/pytest/collect.py +++ b/src/pytest/collect.py @@ -1,10 +1,11 @@ import sys +import warnings from types import ModuleType from typing import Any from typing import List import pytest - +from _pytest.deprecated import PYTEST_COLLECT_MODULE COLLECT_FAKEMODULE_ATTRIBUTES = [ "Collector", @@ -31,8 +32,7 @@ class FakeCollectModule(ModuleType): def __getattr__(self, name: str) -> Any: if name not in self.__all__: raise AttributeError(name) - # Uncomment this after 6.0 release (#7361) - # warnings.warn(PYTEST_COLLECT_MODULE.format(name=name), stacklevel=2) + warnings.warn(PYTEST_COLLECT_MODULE.format(name=name), stacklevel=2) return getattr(pytest, name) |