Skip to content

Commit 8d1f55b

Browse files
Revert pytest-dev#3523 - instead of deprecating we will drop the docs
1 parent a3fb174 commit 8d1f55b

File tree

4 files changed

+3
-35
lines changed

4 files changed

+3
-35
lines changed

src/_pytest/config/findpaths.py

-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from typing import Union
1313

1414
from .exceptions import UsageError
15-
from _pytest.deprecated import SETUP_CFG_CONFIG
1615
from _pytest.outcomes import fail
1716
from _pytest.pathlib import absolutepath
1817
from _pytest.pathlib import commonpath
@@ -72,11 +71,6 @@ def _parse_cfg_file(path: Path) -> PARSE_RESULT:
7271
iniconfig = _parse_ini_config(path)
7372

7473
if "tool:pytest" in iniconfig.sections:
75-
76-
if path.name == "setup.cfg":
77-
warnings.warn_explicit(
78-
SETUP_CFG_CONFIG, None, os.fspath(path), 0, module="pytest"
79-
)
8074
return dict(iniconfig["tool:pytest"].items())
8175
elif "pytest" in iniconfig.sections:
8276
# If a setup.cfg contains a "[pytest]" section, we raise a failure to indicate users that

src/_pytest/deprecated.py

-6
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@
6666
" (options: {names})",
6767
)
6868

69-
SETUP_CFG_CONFIG = PytestDeprecationWarning(
70-
"configuring pytest in setup.cfg has been deprecated \n"
71-
"as pytest and setuptools do not share he same config parser\n"
72-
"please consider pytest.ini/tox.ini or pyproject.toml"
73-
)
74-
7569

7670
HOOK_LEGACY_PATH_ARG = UnformattedWarning(
7771
PytestRemovedIn8Warning,

testing/test_config.py

+3-22
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,9 @@
3131
from _pytest.pytester import Pytester
3232

3333

34-
setup_cfg_nowarn = pytest.mark.filterwarnings(
35-
"ignore:.*setup.cfg.*:pytest.PytestDeprecationWarning"
36-
)
37-
38-
3934
class TestParseIni:
4035
@pytest.mark.parametrize(
41-
"section, filename",
42-
[
43-
("pytest", "pytest.ini"),
44-
pytest.param("tool:pytest", "setup.cfg", marks=setup_cfg_nowarn),
45-
],
36+
"section, filename", [("pytest", "pytest.ini"), ("tool:pytest", "setup.cfg")]
4637
)
4738
def test_getcfg_and_config(
4839
self,
@@ -71,7 +62,6 @@ def test_getcfg_and_config(
7162
config = pytester.parseconfigure(str(sub))
7263
assert config.inicfg["name"] == "value"
7364

74-
@setup_cfg_nowarn
7565
def test_setupcfg_uses_toolpytest_with_pytest(self, pytester: Pytester) -> None:
7666
p1 = pytester.makepyfile("def test(): pass")
7767
pytester.makefile(
@@ -1365,12 +1355,7 @@ def test_simple_noini(self, tmp_path: Path, monkeypatch: MonkeyPatch) -> None:
13651355
"pyproject.toml", "[tool.pytest.ini_options]\nx=10", id="pyproject.toml"
13661356
),
13671357
pytest.param("tox.ini", "[pytest]\nx=10", id="tox.ini"),
1368-
pytest.param(
1369-
"setup.cfg",
1370-
"[tool:pytest]\nx=10",
1371-
id="setup.cfg",
1372-
marks=setup_cfg_nowarn,
1373-
),
1358+
pytest.param("setup.cfg", "[tool:pytest]\nx=10", id="setup.cfg"),
13741359
],
13751360
)
13761361
def test_with_ini(self, tmp_path: Path, name: str, contents: str) -> None:
@@ -1503,7 +1488,6 @@ def test_with_existing_file_in_subdir(
15031488
assert rootpath == tmp_path
15041489
assert inipath is None
15051490

1506-
@setup_cfg_nowarn
15071491
def test_with_config_also_in_parent_directory(
15081492
self, tmp_path: Path, monkeypatch: MonkeyPatch
15091493
) -> None:
@@ -1521,10 +1505,7 @@ def test_with_config_also_in_parent_directory(
15211505

15221506

15231507
class TestOverrideIniArgs:
1524-
@pytest.mark.parametrize(
1525-
"name",
1526-
[pytest.param("setup.cfg", marks=setup_cfg_nowarn), "tox.ini", "pytest.ini"],
1527-
)
1508+
@pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split())
15281509
def test_override_ini_names(self, pytester: Pytester, name: str) -> None:
15291510
section = "[pytest]" if name != "setup.cfg" else "[tool:pytest]"
15301511
pytester.path.joinpath(name).write_text(

testing/test_mark.py

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def test_markers():
122122
rec.assertoutcome(passed=1)
123123

124124

125-
@pytest.mark.filterwarnings("ignore:.*setup.cfg.*:pytest.PytestDeprecationWarning")
126125
def test_marker_without_description(pytester: Pytester) -> None:
127126
pytester.makefile(
128127
".cfg",

0 commit comments

Comments
 (0)