(self, tmp_path: Path)
| 858 | assert config.option.capture == "no" |
| 859 | |
| 860 | def test_inifilename(self, tmp_path: Path) -> None: |
| 861 | d1 = tmp_path.joinpath("foo") |
| 862 | d1.mkdir() |
| 863 | p1 = d1.joinpath("bar.ini") |
| 864 | p1.touch() |
| 865 | p1.write_text( |
| 866 | textwrap.dedent( |
| 867 | """\ |
| 868 | [pytest] |
| 869 | name = value |
| 870 | """ |
| 871 | ) |
| 872 | ) |
| 873 | |
| 874 | inifilename = "../../foo/bar.ini" |
| 875 | option_dict = {"inifilename": inifilename, "capture": "no"} |
| 876 | |
| 877 | cwd = tmp_path.joinpath("a/b") |
| 878 | cwd.mkdir(parents=True) |
| 879 | p2 = cwd.joinpath("pytest.ini") |
| 880 | p2.touch() |
| 881 | p2.write_text( |
| 882 | textwrap.dedent( |
| 883 | """\ |
| 884 | [pytest] |
| 885 | name = wrong-value |
| 886 | should_not_be_set = true |
| 887 | """ |
| 888 | ) |
| 889 | ) |
| 890 | with MonkeyPatch.context() as mp: |
| 891 | mp.chdir(cwd) |
| 892 | config = Config.fromdictargs(option_dict, ()) |
| 893 | inipath = absolutepath(inifilename) |
| 894 | |
| 895 | assert config.args == [str(cwd)] |
| 896 | assert config.option.inifilename == inifilename |
| 897 | assert config.option.capture == "no" |
| 898 | |
| 899 | # this indicates this is the file used for getting configuration values |
| 900 | assert config.inipath == inipath |
| 901 | assert config.inicfg.get("name") == "value" |
| 902 | assert config.inicfg.get("should_not_be_set") is None |
| 903 | |
| 904 | |
| 905 | def test_options_on_small_file_do_not_blow_up(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected