MCPcopy
hub / github.com/pytest-dev/pytest / test_inicfg_deprecated

Method test_inicfg_deprecated

testing/test_config.py:3047–3069  ·  view source on GitHub ↗

Test that accessing config.inicfg issues a deprecation warning.

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

3045 """Tests for the deprecation of config.inicfg."""
3046
3047 def test_inicfg_deprecated(self, pytester: Pytester) -> None:
3048 """Test that accessing config.inicfg issues a deprecation warning."""
3049 pytester.makeini(
3050 """
3051 [pytest]
3052 minversion = 3.0
3053 """
3054 )
3055 config = pytester.parseconfig()
3056
3057 with pytest.warns(
3058 PytestDeprecationWarning, match=r"config\.inicfg is deprecated"
3059 ):
3060 inicfg = config.inicfg # type: ignore[deprecated]
3061
3062 assert config.getini("minversion") == "3.0"
3063 assert inicfg["minversion"] == "3.0"
3064 assert inicfg.get("minversion") == "3.0"
3065 del inicfg["minversion"]
3066 inicfg["minversion"] = "4.0"
3067 assert list(inicfg.keys()) == ["minversion"]
3068 assert list(inicfg.items()) == [("minversion", "4.0")]
3069 assert len(inicfg) == 1
3070
3071 def test_issue_13946_setting_bool_no_longer_crashes(
3072 self, pytester: Pytester

Callers

nothing calls this directly

Calls 4

makeiniMethod · 0.45
parseconfigMethod · 0.45
getiniMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected