Skip to content

Commit 927d9d2

Browse files
committed
Remove deprecated -k -foobar syntax
1 parent 41d8fb0 commit 927d9d2

File tree

3 files changed

+0
-21
lines changed

3 files changed

+0
-21
lines changed

src/_pytest/deprecated.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
"Use @pytest.fixture instead; they are the same."
3838
)
3939

40-
MINUS_K_DASH = PytestRemovedIn7Warning(
41-
"The `-k '-expr'` syntax to -k is deprecated.\nUse `-k 'not expr'` instead."
42-
)
43-
4440
MINUS_K_COLON = PytestRemovedIn7Warning(
4541
"The `-k 'expr:'` syntax to -k is deprecated.\n"
4642
"Please open an issue if you use this and want a replacement."

src/_pytest/mark/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from _pytest.config import UsageError
2525
from _pytest.config.argparsing import Parser
2626
from _pytest.deprecated import MINUS_K_COLON
27-
from _pytest.deprecated import MINUS_K_DASH
2827
from _pytest.stash import StashKey
2928

3029
if TYPE_CHECKING:
@@ -189,10 +188,6 @@ def deselect_by_keyword(items: "List[Item]", config: Config) -> None:
189188
if not keywordexpr:
190189
return
191190

192-
if keywordexpr.startswith("-"):
193-
# To be removed in pytest 8.0.0.
194-
warnings.warn(MINUS_K_DASH, stacklevel=2)
195-
keywordexpr = "not " + keywordexpr[1:]
196191
selectuntil = False
197192
if keywordexpr[-1:] == ":":
198193
# To be removed in pytest 8.0.0.

testing/deprecated_test.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,6 @@ def test_external_plugins_integrated(pytester: Pytester, plugin) -> None:
2727
pytester.parseconfig("-p", plugin)
2828

2929

30-
def test_minus_k_dash_is_deprecated(pytester: Pytester) -> None:
31-
threepass = pytester.makepyfile(
32-
test_threepass="""
33-
def test_one(): assert 1
34-
def test_two(): assert 1
35-
def test_three(): assert 1
36-
"""
37-
)
38-
result = pytester.runpytest("-k=-test_two", threepass)
39-
result.stdout.fnmatch_lines(["*The `-k '-expr'` syntax*deprecated*"])
40-
41-
4230
def test_minus_k_colon_is_deprecated(pytester: Pytester) -> None:
4331
threepass = pytester.makepyfile(
4432
test_threepass="""

0 commit comments

Comments
 (0)