Revert #3523 - instead of deprecating we will drop the docs

This commit is contained in:
Ronny Pfannschmidt 2021-06-06 22:42:36 +02:00
parent 5c3fea0d8b
commit dd7f52b799
4 changed files with 3 additions and 35 deletions

View File

@ -12,7 +12,6 @@ from typing import TYPE_CHECKING
from typing import Union
from .exceptions import UsageError
from _pytest.deprecated import SETUP_CFG_CONFIG
from _pytest.outcomes import fail
from _pytest.pathlib import absolutepath
from _pytest.pathlib import commonpath
@ -72,11 +71,6 @@ def _parse_cfg_file(path: Path) -> PARSE_RESULT:
iniconfig = _parse_ini_config(path)
if "tool:pytest" in iniconfig.sections:
if path.name == "setup.cfg":
warnings.warn_explicit(
SETUP_CFG_CONFIG, None, os.fspath(path), 0, module="pytest"
)
return dict(iniconfig["tool:pytest"].items())
elif "pytest" in iniconfig.sections:
# If a setup.cfg contains a "[pytest]" section, we raise a failure to indicate users that

View File

@ -66,12 +66,6 @@ ARGUMENT_TYPE_STR = UnformattedWarning(
" (options: {names})",
)
SETUP_CFG_CONFIG = PytestDeprecationWarning(
"configuring pytest in setup.cfg has been deprecated \n"
"as pytest and setuptools do not share he same config parser\n"
"please consider pytest.ini/tox.ini or pyproject.toml"
)
HOOK_LEGACY_PATH_ARG = UnformattedWarning(
PytestRemovedIn8Warning,

View File

@ -31,18 +31,9 @@ from _pytest.pathlib import absolutepath
from _pytest.pytester import Pytester
setup_cfg_nowarn = pytest.mark.filterwarnings(
"ignore:.*setup.cfg.*:pytest.PytestDeprecationWarning"
)
class TestParseIni:
@pytest.mark.parametrize(
"section, filename",
[
("pytest", "pytest.ini"),
pytest.param("tool:pytest", "setup.cfg", marks=setup_cfg_nowarn),
],
"section, filename", [("pytest", "pytest.ini"), ("tool:pytest", "setup.cfg")]
)
def test_getcfg_and_config(
self,
@ -71,7 +62,6 @@ class TestParseIni:
config = pytester.parseconfigure(str(sub))
assert config.inicfg["name"] == "value"
@setup_cfg_nowarn
def test_setupcfg_uses_toolpytest_with_pytest(self, pytester: Pytester) -> None:
p1 = pytester.makepyfile("def test(): pass")
pytester.makefile(
@ -1365,12 +1355,7 @@ class TestRootdir:
"pyproject.toml", "[tool.pytest.ini_options]\nx=10", id="pyproject.toml"
),
pytest.param("tox.ini", "[pytest]\nx=10", id="tox.ini"),
pytest.param(
"setup.cfg",
"[tool:pytest]\nx=10",
id="setup.cfg",
marks=setup_cfg_nowarn,
),
pytest.param("setup.cfg", "[tool:pytest]\nx=10", id="setup.cfg"),
],
)
def test_with_ini(self, tmp_path: Path, name: str, contents: str) -> None:
@ -1503,7 +1488,6 @@ class TestRootdir:
assert rootpath == tmp_path
assert inipath is None
@setup_cfg_nowarn
def test_with_config_also_in_parent_directory(
self, tmp_path: Path, monkeypatch: MonkeyPatch
) -> None:
@ -1521,10 +1505,7 @@ class TestRootdir:
class TestOverrideIniArgs:
@pytest.mark.parametrize(
"name",
[pytest.param("setup.cfg", marks=setup_cfg_nowarn), "tox.ini", "pytest.ini"],
)
@pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split())
def test_override_ini_names(self, pytester: Pytester, name: str) -> None:
section = "[pytest]" if name != "setup.cfg" else "[tool:pytest]"
pytester.path.joinpath(name).write_text(

View File

@ -122,7 +122,6 @@ def test_ini_markers_whitespace(pytester: Pytester) -> None:
rec.assertoutcome(passed=1)
@pytest.mark.filterwarnings("ignore:.*setup.cfg.*:pytest.PytestDeprecationWarning")
def test_marker_without_description(pytester: Pytester) -> None:
pytester.makefile(
".cfg",