From b9d9eb6423b0b2e0f6a4806e240bb526dd551f91 Mon Sep 17 00:00:00 2001 From: Andy Freeland Date: Thu, 21 May 2020 17:13:13 -0700 Subject: [PATCH] Support '--unstable-feature' in requirements files This patch adds support for `--unstable-feature` in requirements files so that a project that wants all contributers using the same pip features can specify it in the requirements file. For example, to ensure a requirements file uses the new resolver: ``` --unstable-feature=resolver boto3 boto3==1.13.13 ``` --- news/8293.feature | 1 + src/pip/_internal/req/req_file.py | 1 + tests/unit/test_req_file.py | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 news/8293.feature diff --git a/news/8293.feature b/news/8293.feature new file mode 100644 index 00000000000..482a58b0e67 --- /dev/null +++ b/news/8293.feature @@ -0,0 +1 @@ +Support ``--unstable-feature`` in requirements files diff --git a/src/pip/_internal/req/req_file.py b/src/pip/_internal/req/req_file.py index 63cab76f6f2..0a540bdcfa4 100644 --- a/src/pip/_internal/req/req_file.py +++ b/src/pip/_internal/req/req_file.py @@ -63,6 +63,7 @@ cmdoptions.require_hashes, cmdoptions.pre, cmdoptions.trusted_host, + cmdoptions.unstable_feature, cmdoptions.always_unzip, # Deprecated ] # type: List[Callable[..., optparse.Option]] diff --git a/tests/unit/test_req_file.py b/tests/unit/test_req_file.py index 4ef4f7217e0..a49b8091ef3 100644 --- a/tests/unit/test_req_file.py +++ b/tests/unit/test_req_file.py @@ -382,6 +382,10 @@ def test_noop_always_unzip(self, line_processor, finder): # noop, but confirm it can be set line_processor("--always-unzip", "file", 1, finder=finder) + def test_unstable_feature(self, line_processor): + """--unstable-feature can be set in requirements files.""" + line_processor("--unstable-feature=resolver", "filename", 1) + def test_set_finder_allow_all_prereleases(self, line_processor, finder): line_processor("--pre", "file", 1, finder=finder) assert finder.allow_all_prereleases