#3268 Added deprecation to custom configs

This commit is contained in:
feuillemorte
2018-03-02 10:52:38 +03:00
parent ea854086e1
commit 99aab2c3f5
2 changed files with 13 additions and 0 deletions
+4
View File
@@ -1329,10 +1329,14 @@ def determine_setup(inifile, args, warnfunc=None, rootdir_cmd_arg=None):
if inifile:
iniconfig = py.iniconfig.IniConfig(inifile)
is_cfg_file = str(inifile).endswith('.cfg')
# TODO: [pytest] section in *.cfg files is depricated. Need refactoring.
sections = ['tool:pytest', 'pytest'] if is_cfg_file else ['pytest']
for section in sections:
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)))
break
except KeyError:
inicfg = None