mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Percolate --use-feature from req file upwards
We explicitly propagate --use-feature options from req files upwards. This is not strictly necessary for the option to be enabled, because of the default value is a global list, but that implicit behaviour is certainly accidental, so we make it explicit, with a test.
This commit is contained in:
parent
7a3c802626
commit
38fe3c2f14
|
@ -225,12 +225,18 @@ def handle_option_line(
|
|||
):
|
||||
# type: (...) -> None
|
||||
|
||||
# percolate hash-checking option upward
|
||||
if options and opts.require_hashes:
|
||||
options.require_hashes = opts.require_hashes
|
||||
if options:
|
||||
# percolate options upward
|
||||
if opts.require_hashes:
|
||||
options.require_hashes = opts.require_hashes
|
||||
if opts.features_enabled:
|
||||
options.features_enabled.extend(
|
||||
f for f in opts.features_enabled
|
||||
if f not in options.features_enabled
|
||||
)
|
||||
|
||||
# set finder options
|
||||
elif finder:
|
||||
if finder:
|
||||
find_links = finder.find_links
|
||||
index_urls = finder.index_urls
|
||||
if opts.index_url:
|
||||
|
|
|
@ -47,6 +47,7 @@ def options(session):
|
|||
isolated_mode=False,
|
||||
index_url='default_url',
|
||||
format_control=FormatControl(set(), set()),
|
||||
features_enabled=[],
|
||||
)
|
||||
|
||||
|
||||
|
@ -382,9 +383,12 @@ class TestProcessLine(object):
|
|||
line_processor("--pre", "file", 1, finder=finder)
|
||||
assert finder.allow_all_prereleases
|
||||
|
||||
def test_use_feature(self, line_processor):
|
||||
def test_use_feature(self, line_processor, options):
|
||||
"""--use-feature can be set in requirements files."""
|
||||
line_processor("--use-feature=2020-resolver", "filename", 1)
|
||||
line_processor(
|
||||
"--use-feature=2020-resolver", "filename", 1, options=options
|
||||
)
|
||||
assert "2020-resolver" in options.features_enabled
|
||||
|
||||
def test_relative_local_find_links(
|
||||
self, line_processor, finder, monkeypatch, tmpdir
|
||||
|
|
Loading…
Reference in a new issue