Adjust stacklevel of "config" warnings

Related to #4439
This commit is contained in:
Bruno Oliveira
2018-11-22 14:44:01 -02:00
parent 45c33c4e05
commit aa765cf8c2
7 changed files with 14 additions and 7 deletions

View File

@@ -42,6 +42,7 @@ def getcfg(args, config=None):
CFG_PYTEST_SECTION.format(filename=inibasename)
),
config=config,
stacklevel=2,
)
return base, p, iniconfig["pytest"]
if (
@@ -116,7 +117,9 @@ def determine_setup(inifile, args, rootdir_cmd_arg=None, config=None):
# TODO: [pytest] section in *.cfg files is deprecated. Need refactoring once
# the deprecation expires.
_issue_config_warning(
CFG_PYTEST_SECTION.format(filename=str(inifile)), config
CFG_PYTEST_SECTION.format(filename=str(inifile)),
config,
stacklevel=2,
)
break
except KeyError: