-
Notifications
You must be signed in to change notification settings - Fork 3k
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
CLI parses unrelated config files and then crashes #5182
Comments
Setuptools behavior is the same (see discussion). But pytest uses |
And |
I'm pretty sure we can try printing a better error message for this case. This is precisely why I think #3809 (or something similar) is a good idea -- ini is not a standardized format. |
Could you clear up a curiousity: why does pip want to read
Maybe I'm missing something obvious here, but it seems like a
|
this shoudl be better documented in pytest - if the canonical configfile isnt used, its up to the user not to break the configfiles of other tools |
Which is canonical? |
@wimglenn correct, BTW im one of the pytest maintainers |
I like having pytest config as a section in |
@wimglenn until there is a common configformat with a common api, is most sensible to keep things in different files since different things can easily breka each other hopefully |
I've run into this myself. This makes essentially not possible to put Unicode characters inside |
I stumbled into the same even in versions 20.* |
@gaborbernat How did Setuptools communicate the encoding change when it happened? IMO it is reasonable to change to parser encoding to UTF-8, but I don’t want to break whatever is relying on platform encoding. |
As far as I remember later setuptools switched to utf 8 encoding so this should not be a problem now with latest pip and setuptools 🤔 |
Hmm, taking another look, this config file parsing logic is buried deep inside distutils. Does Setuptools use its own implementation? Not sure what’s the best course for pip to deal with this… |
setuptools has it's own copy of dist; https://github.com/pypa/setuptools/blob/master/setuptools/dist.py#L553; was this release https://setuptools.readthedocs.io/en/latest/history.html#v41-0-0 that made it UTF-8 |
Thanks for the clarification! pip is really short of options here (it can’t even just ignore the offending file, since the loop itself is buried in distutils). I guess it’s not very realistic to have another copy of dist in pip, so we can either push a new |
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
- Running flake8 via tox, e.g., `tox -e flake8` crashes. Setuptools uses configparser to read the config, which throws configparser.InterpolationMissingOptionError because of the percent (%) symbols in the format string. - Ref: pytest-dev/pytest#3062 pypa/pip#5182
rather annoying :/ |
pytest was using config from `tox.ini` preferentially and ignoring config from `setup.cfg`, as a side-effect doctests were not running on code/docstrings in `rdflib/`. The reason why some pytest config was in `tox.ini` instead of `setup.cfg` was because of these issues: - pypa/pip#5182 - pytest-dev/pytest#3062 As a compromise to fix this I have opted for moving all pytest config to `pyproject.toml`: - https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml This seems sensible as `pyproject.toml` is standarized by PEPs and eventually most things from `setup.cfg` will end up in there anyway. Also: - remove the pytest ignore on `test/translate_algebra` as tests in there have been running and passing for some time. - fixed path to test data in `rdflib/plugins/parsers/nquads.py`.
This is no longer an issue in 3.10+. Closing this out to reflect that. |
Related: #11298 |
Local project keeps configuration in a
[tool:pytest]
section ofsetup.cfg
. Can't use pip from within that directory, because it attempts to parse the file incorrectly (using aConfigParser
with interpolation) and then crashes out.minimal steps to reproduce:
setup.cfg
file in cwd:pip install --upgrade pip
.That's a valid pytest config section but
ConfigParser
is getting confused thinking parts of the logging config are interpolation references. I don't know how best to fix this issue because it's actually indistutils.dist.Distribution
where they create aConfigParser
and there is not public API to enable/disable interpolation. However, perhaps pip'slocations.py
shouldn't be attempting to eagerly parse this file in the first place?Existing workaround: Changing out of the directory that has
setup.cfg
before usingpip
.The text was updated successfully, but these errors were encountered: