Pytest: deprecate setup.cfg support

Created on 31 May 2018  路  7Comments  路  Source: pytest-dev/pytest

#3062 demonstrates that its not a sustainable option to hijack config files that will be parsed using a different parser

we should deprecate setup.cfg usage and unless someone comes up with a sustainable option to support it, drop it

config deprecation

Most helpful comment

@blueyed feel free to make a pr implementing that

im going to deprecate it as i dont have the time and motivation and its currently broken in strange ways - im happy to keep it if somebody comes up with a reasonably correct way to have pytest config in setup.cfg that is not completely mindboogling

however also keep in mind that pyproject.toml is upcoming, already standardized and very likely a much saner migration target

All 7 comments

GitMate.io thinks possibly related issues are https://github.com/pytest-dev/pytest/issues/3086 (Remove [pytest] section support in setup.cfg), https://github.com/pytest-dev/pytest/issues/3050 (deprecate pytest.config), https://github.com/pytest-dev/pytest/issues/3268 (Issue warning when "[pytest]" section is used in a ".cfg" file passed with "-c"), https://github.com/pytest-dev/pytest/issues/830 (deprecate resultlog), and https://github.com/pytest-dev/pytest/issues/2107 (pytest alias in setup.cfg not working).

I've skimmed https://github.com/pytest-dev/pytest/issues/3062 - and see the issue, but just wanted to state that I considered setup.cfg a good central place for configuring different tools, and not having pytest there anymore would be bad.

  1. Given that it causes no problems for most users it might be better to never drop it, but rather not recommend it (i.e. in docs)?

  2. pytest should probably just use configparser for setup.cfg, too (https://github.com/pytest-dev/pytest/issues/3062#issuecomment-356658123). While this would not work with Python 2 out of the box, we could either find some workaround, or document that for Python 2 you would have to use pytest.ini (that could probably be detected even).

I agree that it is quite messy, but having to move pytest config from setup.cfg to pytest.ini will also be messy for pytest users, especially since only users that configure "log_format" and similar options are affected in the end.

And for Python 3 (the future) it seems to be straight-forward: configparser should be used, which then would also enable the feature it provides, that is causing this issue in the first place.
Sure, "log_format" would look different when being used in setup.cfg vs. pytest.ini, but that appears to be necessary for setup.cfg - and makes sense once you know about its interpolation feature.

@blueyed feel free to make a pr implementing that

im going to deprecate it as i dont have the time and motivation and its currently broken in strange ways - im happy to keep it if somebody comes up with a reasonably correct way to have pytest config in setup.cfg that is not completely mindboogling

however also keep in mind that pyproject.toml is upcoming, already standardized and very likely a much saner migration target

This has been deprecated for some time

we should deprecate setup.cfg usage

Then I might have understood it incorrectly - I've assumed [tool:pytest] should also be deprecated (but I just saw that 3.7.4 complains about [pytest] that should become [tool:pytest]).
If this is only about [pytest] without tool: prefix I am totally fine with it.
But from the initial comment I think @RonnyPfannschmidt wants to deprecate it altogether?!
(I've found 0fffa6ba when looking quickly around, but it appears to be about [pytest] only - https://github.com/blueyed/pytest/blob/661c00009763ffc57f018057775497accb1c9409/src/_pytest/deprecated.py#L58-L61.

So, re-open?

yes - re-open for sure

se need to drop pytest section support for setup.cfg at some point - its fundamentally broken

My bad guys. I've changed the title to what I think better conveys the purpose of the issue then, let me know if it's not good yet.

Was this page helpful?
0 / 5 - 0 ratings