From 143ac5af99cc56b1868741b095ad7db7eccde73c Mon Sep 17 00:00:00 2001 From: feuillemorte Date: Tue, 27 Feb 2018 19:26:35 +0300 Subject: [PATCH] #3260 Fix config.py for py27 --- _pytest/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_pytest/config.py b/_pytest/config.py index 68d66ee2a..c84bbe134 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -1327,14 +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 + 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', inifile)) + warnfunc('C1', SETUP_CFG_PYTEST.replace('setup.cfg', str(inifile))) break except KeyError: inicfg = None