Skip to content

Added warning when "[pytest]" section is used in a ".cfg" file passed with "-c" #3274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 2, 2018
Merged

Added warning when "[pytest]" section is used in a ".cfg" file passed with "-c" #3274

merged 3 commits into from
Mar 2, 2018

Conversation

feuillemorte
Copy link
Contributor

Fixes #3268

@feuillemorte feuillemorte requested a review from nicoddemus March 2, 2018 08:00
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall well done 👍

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', str(inifile)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency, lets turn SETUP_CFG_PYTEST into a format string and use something like CFG_PYTEST_SETION.format(filename=apath) on all usage sites

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@coveralls
Copy link

coveralls commented Mar 2, 2018

Coverage Status

Coverage increased (+0.05%) to 92.647% when pulling f501d00 on feuillemorte:3268-add-deprecation into ea85408 on pytest-dev:features.

@nicoddemus
Copy link
Member

Cool thanks!

@nicoddemus nicoddemus merged commit 1549d61 into pytest-dev:features Mar 2, 2018
@feuillemorte feuillemorte deleted the 3268-add-deprecation branch March 2, 2018 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants