#3260 Fix pytest section in setup ini file

This commit is contained in:
feuillemorte 2018-02-27 19:02:49 +03:00
parent ae62ced080
commit 3f7223af44
1 changed files with 11 additions and 4 deletions

View File

@ -1327,8 +1327,15 @@ def determine_setup(inifile, args, warnfunc=None):
dirs = get_dirs_from_args(args)
if inifile:
iniconfig = py.iniconfig.IniConfig(inifile)
is_cfg_file = '.cfg' in inifile
sections = ['tool:pytest', 'pytest'] if is_cfg_file else ['pytest']
for section in sections:
try:
inicfg = iniconfig["pytest"]
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', inifile))
break
except KeyError:
inicfg = None
rootdir = get_common_ancestor(dirs)