testing/test_config: check inipath instead of inifile

inifile is soft-deprecated in favor of inipath.
This commit is contained in:
Ran Benita 2020-12-19 14:49:24 +02:00
parent 8b220fad4d
commit 170a2c5040
1 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,6 @@ from typing import Type
from typing import Union from typing import Union
import attr import attr
import py.path
import _pytest._code import _pytest._code
import pytest import pytest
@ -28,6 +27,7 @@ from _pytest.config.findpaths import determine_setup
from _pytest.config.findpaths import get_common_ancestor from _pytest.config.findpaths import get_common_ancestor
from _pytest.config.findpaths import locate_config from _pytest.config.findpaths import locate_config
from _pytest.monkeypatch import MonkeyPatch from _pytest.monkeypatch import MonkeyPatch
from _pytest.pathlib import absolutepath
from _pytest.pytester import Pytester from _pytest.pytester import Pytester
@ -854,8 +854,8 @@ class TestConfigFromdictargs:
) )
) )
inifile = "../../foo/bar.ini" inifilename = "../../foo/bar.ini"
option_dict = {"inifilename": inifile, "capture": "no"} option_dict = {"inifilename": inifilename, "capture": "no"}
cwd = tmp_path.joinpath("a/b") cwd = tmp_path.joinpath("a/b")
cwd.mkdir(parents=True) cwd.mkdir(parents=True)
@ -873,14 +873,14 @@ class TestConfigFromdictargs:
with MonkeyPatch.context() as mp: with MonkeyPatch.context() as mp:
mp.chdir(cwd) mp.chdir(cwd)
config = Config.fromdictargs(option_dict, ()) config = Config.fromdictargs(option_dict, ())
inipath = py.path.local(inifile) inipath = absolutepath(inifilename)
assert config.args == [str(cwd)] assert config.args == [str(cwd)]
assert config.option.inifilename == inifile assert config.option.inifilename == inifilename
assert config.option.capture == "no" assert config.option.capture == "no"
# this indicates this is the file used for getting configuration values # this indicates this is the file used for getting configuration values
assert config.inifile == inipath assert config.inipath == inipath
assert config.inicfg.get("name") == "value" assert config.inicfg.get("name") == "value"
assert config.inicfg.get("should_not_be_set") is None assert config.inicfg.get("should_not_be_set") is None