summaryrefslogtreecommitdiff
path: root/tests/unit/test_req_file.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_req_file.py')
-rw-r--r--tests/unit/test_req_file.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/tests/unit/test_req_file.py b/tests/unit/test_req_file.py
index 30cbcf71c..439c41563 100644
--- a/tests/unit/test_req_file.py
+++ b/tests/unit/test_req_file.py
@@ -1,7 +1,6 @@
import collections
import logging
import os
-import subprocess
import textwrap
from optparse import Values
from pathlib import Path
@@ -74,7 +73,13 @@ def parse_reqfile(
options=options,
constraint=constraint,
):
- yield install_req_from_parsed_requirement(parsed_req, isolated=isolated)
+ yield install_req_from_parsed_requirement(
+ parsed_req,
+ isolated=isolated,
+ config_settings=parsed_req.options.get("config_settings")
+ if parsed_req.options
+ else None,
+ )
def test_read_file_url(tmp_path: Path, session: PipSession) -> None:
@@ -344,10 +349,14 @@ class TestProcessLine:
assert reqs[0].constraint
def test_options_on_a_requirement_line(self, line_processor: LineProcessor) -> None:
- line = 'SomeProject --global-option="yo3" --global-option "yo4"'
+ line = (
+ 'SomeProject --global-option="yo3" --global-option "yo4" '
+ '--config-settings="yo3=yo4" --config-settings "yo1=yo2"'
+ )
filename = "filename"
req = line_processor(line, filename, 1)[0]
assert req.global_options == ["yo3", "yo4"]
+ assert req.config_settings == {"yo3": "yo4", "yo1": "yo2"}
def test_hash_options(self, line_processor: LineProcessor) -> None:
"""Test the --hash option: mostly its value storage.
@@ -613,7 +622,6 @@ class TestBreakOptionsArgs:
class TestOptionVariants:
-
# this suite is really just testing optparse, but added it anyway
def test_variant1(
@@ -881,14 +889,4 @@ class TestParseRequirements:
)
)
- req.source_dir = os.curdir
- with mock.patch.object(subprocess, "Popen") as popen:
- popen.return_value.stdout.readline.return_value = b""
- try:
- req.install([])
- except Exception:
- pass
-
- last_call = popen.call_args_list[-1]
- args = last_call[0][0]
- assert 0 < args.index(global_option) < args.index("install")
+ assert req.global_options == [global_option]