Skip to content

Commit ec09765

Browse files
committed
Fix bad indentation level in src/pip/_internal/cli/parser.py
The regression was introduced in 9f082bc and was leading to configuration entries being yielded multiple times, turning them to list instead of simple values and thus their validations were failing. Fixes #13548.
1 parent d52011f commit ec09765

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

news/13548.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix regression in configuration parsing that was turning a single value
2+
into a list and thus leading to a validation error.

src/pip/_internal/cli/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ def _get_ordered_configuration_items(
203203
if section in override_order:
204204
section_items[section].append((key, val))
205205

206-
# Yield each group in their override order
207-
for section in override_order:
208-
yield from section_items[section]
206+
# Yield each group in their override order
207+
for section in override_order:
208+
yield from section_items[section]
209209

210210
def _update_defaults(self, defaults: dict[str, Any]) -> dict[str, Any]:
211211
"""Updates the given defaults with values from the config files and

tests/functional/test_configuration.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
import sys
1010
import textwrap
1111

12+
import pytest
13+
1214
from pip._internal.cli.status_codes import ERROR
1315
from pip._internal.configuration import CONFIG_BASENAME, Kind
1416
from pip._internal.configuration import get_configuration_files as _get_config_files
1517
from pip._internal.utils.compat import WINDOWS
1618

17-
from tests.lib import PipTestEnvironment
19+
from tests.lib import PipTestEnvironment, TestData
1820
from tests.lib.configuration_helpers import ConfigurationMixin, kinds
1921
from tests.lib.venv import VirtualEnvironment
2022

@@ -212,3 +214,21 @@ def test_config_separated(
212214
),
213215
result.stdout,
214216
)
217+
218+
@pytest.mark.network
219+
def test_editable_mode_default_config(
220+
self, script: PipTestEnvironment, data: TestData
221+
) -> None:
222+
"""Test that setting default editable mode through configuration works
223+
as expected.
224+
"""
225+
script.pip(
226+
"config", "--site", "set", "install.config-settings", "editable_mode=strict"
227+
)
228+
to_install = data.src.joinpath("simplewheel-1.0")
229+
script.pip("install", "-e", to_install)
230+
assert os.path.isdir(
231+
os.path.join(
232+
to_install, "build", "__editable__.simplewheel-1.0-py3-none-any"
233+
)
234+
)

0 commit comments

Comments
 (0)