mirror of https://github.com/pypa/pip
Merge pull request #6491 from DavidBord/fix-5963-fail-elegantly-incorrect-config
fix-5963: fail elegantly
This commit is contained in:
commit
6387867288
|
@ -0,0 +1 @@
|
|||
Fail elegantly when trying to set an incorrectly formatted key in config.
|
|
@ -50,6 +50,12 @@ def _normalize_name(name):
|
|||
|
||||
def _disassemble_key(name):
|
||||
# type: (str) -> List[str]
|
||||
if "." not in name:
|
||||
error_message = (
|
||||
"Key does not contain dot separated section and key. "
|
||||
"Perhaps you wanted to use 'global.{}' instead?"
|
||||
).format(name)
|
||||
raise ConfigurationError(error_message)
|
||||
return name.split(".", 1)
|
||||
|
||||
|
||||
|
|
|
@ -57,3 +57,8 @@ class TestBasicLoading(ConfigurationMixin):
|
|||
"""
|
||||
|
||||
assert lines == textwrap.dedent(expected).strip().splitlines()
|
||||
|
||||
def test_forget_section(self, script):
|
||||
result = script.pip("config", "set", "isolated", "true",
|
||||
expect_error=True)
|
||||
assert "global.isolated" in result.stderr
|
||||
|
|
Loading…
Reference in New Issue