#3260 Fix pytest section in setup ini file
This commit is contained in:
parent
ae62ced080
commit
3f7223af44
|
@ -1327,10 +1327,17 @@ def determine_setup(inifile, args, warnfunc=None):
|
||||||
dirs = get_dirs_from_args(args)
|
dirs = get_dirs_from_args(args)
|
||||||
if inifile:
|
if inifile:
|
||||||
iniconfig = py.iniconfig.IniConfig(inifile)
|
iniconfig = py.iniconfig.IniConfig(inifile)
|
||||||
try:
|
is_cfg_file = '.cfg' in inifile
|
||||||
inicfg = iniconfig["pytest"]
|
sections = ['tool:pytest', 'pytest'] if is_cfg_file else ['pytest']
|
||||||
except KeyError:
|
for section in sections:
|
||||||
inicfg = 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', inifile))
|
||||||
|
break
|
||||||
|
except KeyError:
|
||||||
|
inicfg = None
|
||||||
rootdir = get_common_ancestor(dirs)
|
rootdir = get_common_ancestor(dirs)
|
||||||
else:
|
else:
|
||||||
ancestor = get_common_ancestor(dirs)
|
ancestor = get_common_ancestor(dirs)
|
||||||
|
|
Loading…
Reference in New Issue