Repository navigation
fix(nodeenv): raise on bad config references again - #458
Conversation
ekalinin
left a comment
There was a problem hiding this comment.
Thanks for the patch! Three things before merge.
-
A typo in the reference syntax itself still gets through:
%(base)/nodejs(nos) raisesInterpolationSyntaxError, so it is still read as written. Falling back only when the value has no%(covers it:except InterpolationSyntaxError: # A percent-encoded mirror login, #440 val = ini_file.get(section, attr, raw=True) if '%(' in val: raise
A percent-encoded URL never has
%(, so%40and%%40still give%40, and a value with a%(name)sreference and a stray%raises, as it did before #449. A('%(base)/nodejs', configparser.InterpolationSyntaxError)case intest_config_reports_bad_referenceswould pin it. I checked it on a copy of master'snodeenv.py: that case fails with this branch's change and passes with the two lines. -
The #440 entry in
CHANGESsays "a value that can't be interpolated is read as written", which is no longer true now that a missing key or a loop raises again. Something like:- A ``%`` in a ``[nodeenv]`` config value, such as a percent-encoded mirror login, no longer crashes nodeenv: a value that can't be interpolated and has no ``%(name)s`` reference is read as written. ``%%`` still gives ``%``, which ``setup.cfg`` needs, as setuptools reads that file too `#440 <https://github.com/ekalinin/nodeenv/issues/440>`_
-
Please rebase on master: #459 added
import _threadon the line where this PR addsimport configparser, so the branch conflicts now.
f4013f2 to
ff4f140
Compare
|
Thanks, all three done in ff4f140:
|
Fixes #456
#449 fell back to the raw value on any
InterpolationError, so a typo in a%(name)sreference or a reference loop was read as written and failed later with a confusing download error. This catches onlyInterpolationSyntaxError, which is what a stray%such as a percent-encoded mirror login raises. The #440 cases still read as before.I added tests for the missing-key and reference-loop cases; both fail on master.
toxchecks pass locally (pytest without integration tests and flake8, Python 3.13).toxpasses: the tests and flake8CHANGEShas an entry underVersion [unreleased], if nodeenv'sbehavior changes
README.rstis updated, if the change affects what it documentstype(scope): subject