Skip to content

Commit dca95c7

Browse files
committed
Suppress MINUS_K_COLON and MINUS_K_DASH warnings until 6.1
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 pytest-dev#7361
1 parent 8124688 commit dca95c7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/_pytest/mark/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
""" generic mechanism for marking and selecting python functions. """
22
import typing
3-
import warnings
43
from typing import AbstractSet
54
from typing import List
65
from typing import Optional
@@ -23,8 +22,6 @@
2322
from _pytest.config import hookimpl
2423
from _pytest.config import UsageError
2524
from _pytest.config.argparsing import Parser
26-
from _pytest.deprecated import MINUS_K_COLON
27-
from _pytest.deprecated import MINUS_K_DASH
2825
from _pytest.store import StoreKey
2926

3027
if TYPE_CHECKING:
@@ -181,12 +178,14 @@ def deselect_by_keyword(items: "List[Item]", config: Config) -> None:
181178

182179
if keywordexpr.startswith("-"):
183180
# To be removed in pytest 7.0.0.
184-
warnings.warn(MINUS_K_DASH, stacklevel=2)
181+
# Uncomment this after 6.0 release (#7361)
182+
# warnings.warn(MINUS_K_DASH, stacklevel=2)
185183
keywordexpr = "not " + keywordexpr[1:]
186184
selectuntil = False
187185
if keywordexpr[-1:] == ":":
188186
# To be removed in pytest 7.0.0.
189-
warnings.warn(MINUS_K_COLON, stacklevel=2)
187+
# Uncomment this after 6.0 release (#7361)
188+
# warnings.warn(MINUS_K_COLON, stacklevel=2)
190189
selectuntil = True
191190
keywordexpr = keywordexpr[:-1]
192191

testing/deprecated_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def test__fillfuncargs_is_deprecated() -> None:
125125
pytest._fillfuncargs(mock.Mock())
126126

127127

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

139140

141+
@pytest.mark.skip(reason="should be reintroduced in 6.1: #7361")
140142
def test_minus_k_colon_is_deprecated(testdir) -> None:
141143
threepass = testdir.makepyfile(
142144
test_threepass="""

0 commit comments

Comments
 (0)