#3260 Fix config.py for py27
This commit is contained in:
parent
409b919fc0
commit
143ac5af99
|
@ -1327,14 +1327,15 @@ 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)
|
||||||
is_cfg_file = '.cfg' in 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']
|
sections = ['tool:pytest', 'pytest'] if is_cfg_file else ['pytest']
|
||||||
for section in sections:
|
for section in sections:
|
||||||
try:
|
try:
|
||||||
inicfg = iniconfig[section]
|
inicfg = iniconfig[section]
|
||||||
if is_cfg_file and section == 'pytest' and warnfunc:
|
if is_cfg_file and section == 'pytest' and warnfunc:
|
||||||
from _pytest.deprecated import SETUP_CFG_PYTEST
|
from _pytest.deprecated import SETUP_CFG_PYTEST
|
||||||
warnfunc('C1', SETUP_CFG_PYTEST.replace('setup.cfg', inifile))
|
warnfunc('C1', SETUP_CFG_PYTEST.replace('setup.cfg', str(inifile)))
|
||||||
break
|
break
|
||||||
except KeyError:
|
except KeyError:
|
||||||
inicfg = None
|
inicfg = None
|
||||||
|
|
Loading…
Reference in New Issue