Skip to content

Commit

Permalink
Suppress MINUS_K_COLON and MINUS_K_DASH warnings until 6.1
Browse files Browse the repository at this point in the history
They were introduced near 6.0 release where we turn deprecation
warnings into errors, so we need to turn those warnings off until 6.1.

Related to #7361
  • Loading branch information
nicoddemus committed Jun 13, 2020
1 parent 8124688 commit dca95c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/_pytest/mark/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
""" generic mechanism for marking and selecting python functions. """
import typing
import warnings
from typing import AbstractSet
from typing import List
from typing import Optional
Expand All @@ -23,8 +22,6 @@
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:
Expand Down Expand Up @@ -181,12 +178,14 @@ def deselect_by_keyword(items: "List[Item]", config: Config) -> None:

if keywordexpr.startswith("-"):
# To be removed in pytest 7.0.0.
warnings.warn(MINUS_K_DASH, stacklevel=2)
# Uncomment this after 6.0 release (#7361)
# warnings.warn(MINUS_K_DASH, stacklevel=2)
keywordexpr = "not " + keywordexpr[1:]
selectuntil = False
if keywordexpr[-1:] == ":":
# To be removed in pytest 7.0.0.
warnings.warn(MINUS_K_COLON, stacklevel=2)
# Uncomment this after 6.0 release (#7361)
# warnings.warn(MINUS_K_COLON, stacklevel=2)
selectuntil = True
keywordexpr = keywordexpr[:-1]

Expand Down
2 changes: 2 additions & 0 deletions testing/deprecated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def test__fillfuncargs_is_deprecated() -> None:
pytest._fillfuncargs(mock.Mock())


@pytest.mark.skip(reason="should be reintroduced in 6.1: #7361")
def test_minus_k_dash_is_deprecated(testdir) -> None:
threepass = testdir.makepyfile(
test_threepass="""
Expand All @@ -137,6 +138,7 @@ def test_three(): assert 1
result.stdout.fnmatch_lines(["*The `-k '-expr'` syntax*deprecated*"])


@pytest.mark.skip(reason="should be reintroduced in 6.1: #7361")
def test_minus_k_colon_is_deprecated(testdir) -> None:
threepass = testdir.makepyfile(
test_threepass="""
Expand Down

0 comments on commit dca95c7

Please sign in to comment.