From f501d0021c3a86a46da928cf0fc3d806fd5ac03d Mon Sep 17 00:00:00 2001 From: feuillemorte Date: Fri, 2 Mar 2018 11:28:30 +0300 Subject: [PATCH] #3268 Fix warning variable --- _pytest/config.py | 8 ++++---- _pytest/deprecated.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_pytest/config.py b/_pytest/config.py index 54efdde1f..908c5bf5a 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -1251,7 +1251,7 @@ def getcfg(args, warnfunc=None): This parameter should be removed when pytest adopts standard deprecation warnings (#1804). """ - from _pytest.deprecated import SETUP_CFG_PYTEST + from _pytest.deprecated import CFG_PYTEST_SECTION inibasenames = ["pytest.ini", "tox.ini", "setup.cfg"] args = [x for x in args if not str(x).startswith("-")] if not args: @@ -1265,7 +1265,7 @@ def getcfg(args, warnfunc=None): iniconfig = py.iniconfig.IniConfig(p) if 'pytest' in iniconfig.sections: if inibasename == 'setup.cfg' and warnfunc: - warnfunc('C1', SETUP_CFG_PYTEST) + warnfunc('C1', CFG_PYTEST_SECTION.format(filename=inibasename)) return base, p, iniconfig['pytest'] if inibasename == 'setup.cfg' and 'tool:pytest' in iniconfig.sections: return base, p, iniconfig['tool:pytest'] @@ -1335,8 +1335,8 @@ def determine_setup(inifile, args, warnfunc=None, rootdir_cmd_arg=None): try: inicfg = iniconfig[section] if is_cfg_file and section == 'pytest' and warnfunc: - from _pytest.deprecated import SETUP_CFG_PYTEST - warnfunc('C1', SETUP_CFG_PYTEST.replace('setup.cfg', str(inifile))) + from _pytest.deprecated import CFG_PYTEST_SECTION + warnfunc('C1', CFG_PYTEST_SECTION.format(filename=str(inifile))) break except KeyError: inicfg = None diff --git a/_pytest/deprecated.py b/_pytest/deprecated.py index aa1235013..1eae354b3 100644 --- a/_pytest/deprecated.py +++ b/_pytest/deprecated.py @@ -22,7 +22,7 @@ FUNCARG_PREFIX = ( 'and scheduled to be removed in pytest 4.0. ' 'Please remove the prefix and use the @pytest.fixture decorator instead.') -SETUP_CFG_PYTEST = '[pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.' +CFG_PYTEST_SECTION = '[pytest] section in {filename} files is deprecated, use [tool:pytest] instead.' GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue"