mirror of https://github.com/pypa/pip
Merge pull request #2 from sbidoul/use-feature-test
Percolate --use-feature from req file upwards
This commit is contained in:
commit
e399b128b2
|
@ -225,12 +225,18 @@ def handle_option_line(
|
||||||
):
|
):
|
||||||
# type: (...) -> None
|
# type: (...) -> None
|
||||||
|
|
||||||
# percolate hash-checking option upward
|
if options:
|
||||||
if options and opts.require_hashes:
|
# percolate options upward
|
||||||
options.require_hashes = opts.require_hashes
|
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
|
# set finder options
|
||||||
elif finder:
|
if finder:
|
||||||
find_links = finder.find_links
|
find_links = finder.find_links
|
||||||
index_urls = finder.index_urls
|
index_urls = finder.index_urls
|
||||||
if opts.index_url:
|
if opts.index_url:
|
||||||
|
|
|
@ -47,6 +47,7 @@ def options(session):
|
||||||
isolated_mode=False,
|
isolated_mode=False,
|
||||||
index_url='default_url',
|
index_url='default_url',
|
||||||
format_control=FormatControl(set(), set()),
|
format_control=FormatControl(set(), set()),
|
||||||
|
features_enabled=[],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,9 +383,12 @@ class TestProcessLine(object):
|
||||||
line_processor("--pre", "file", 1, finder=finder)
|
line_processor("--pre", "file", 1, finder=finder)
|
||||||
assert finder.allow_all_prereleases
|
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."""
|
"""--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(
|
def test_relative_local_find_links(
|
||||||
self, line_processor, finder, monkeypatch, tmpdir
|
self, line_processor, finder, monkeypatch, tmpdir
|
||||||
|
|
Loading…
Reference in New Issue