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

Method test_with_ini

testing/test_config.py:1933–1960  ·  view source on GitHub ↗
(self, tmp_path: Path, name: str, contents: str)

Source from the content-addressed store, hash-verified

1931 ],
1932 )
1933 def test_with_ini(self, tmp_path: Path, name: str, contents: str) -> None:
1934 inipath = tmp_path / name
1935 inipath.write_text(contents, encoding="utf-8")
1936
1937 a = tmp_path / "a"
1938 a.mkdir()
1939 b = a / "b"
1940 b.mkdir()
1941 for args in ([str(tmp_path)], [str(a)], [str(b)]):
1942 rootpath, parsed_inipath, *_ = determine_setup(
1943 inifile=None,
1944 override_ini=None,
1945 args=args,
1946 rootdir_cmd_arg=None,
1947 invocation_dir=Path.cwd(),
1948 )
1949 assert rootpath == tmp_path
1950 assert parsed_inipath == inipath
1951 rootpath, parsed_inipath, ini_config, _ = determine_setup(
1952 inifile=None,
1953 override_ini=None,
1954 args=[str(b), str(a)],
1955 rootdir_cmd_arg=None,
1956 invocation_dir=Path.cwd(),
1957 )
1958 assert rootpath == tmp_path
1959 assert parsed_inipath == inipath
1960 assert ini_config["x"] == ConfigValue("10", origin="file", mode="ini")
1961
1962 @pytest.mark.parametrize("pytest_ini", ["pytest.ini", ".pytest.ini"])
1963 @pytest.mark.parametrize("other", ["setup.cfg", "tox.ini"])

Callers

nothing calls this directly

Calls 4

determine_setupFunction · 0.90
ConfigValueClass · 0.90
write_textMethod · 0.80
mkdirMethod · 0.45

Tested by

no test coverage detected