Merge pull request #2 from sbidoul/use-feature-test

Percolate --use-feature from req file upwards
This commit is contained in:
Andy Freeland 2020-07-25 09:41:37 -07:00 committed by GitHub
commit e399b128b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -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:

View File

@ -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