Skip to content

Commit 4cceb48

Browse files
committed
Add test for extras
1 parent 60aa616 commit 4cceb48

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/unit/test_req_install.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,29 @@ def test_install_req_from_string_pep508_url_wheel(self, use_pep517):
129129
assert install_req.is_wheel
130130
assert install_req.use_pep517 == use_pep517
131131

132+
@pytest.mark.parametrize("use_pep517", [None, True, False])
133+
def test_install_req_from_string_pep508_url_wheel_extras(self, use_pep517):
134+
"""
135+
install_req_from_string parses the version and extras from PEP 508 URLs
136+
that point to wheels so that updating the URL reinstalls the package.
137+
"""
138+
wheel_url = (
139+
"https://files.pythonhosted.org/packages/51/bd/"
140+
"23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/"
141+
"requests-2.22.0-py2.py3-none-any.whl"
142+
)
143+
install_str = "requests[security] @ " + wheel_url
144+
install_req = install_req_from_req_string(
145+
install_str, use_pep517=use_pep517
146+
)
147+
148+
assert isinstance(install_req, InstallRequirement)
149+
assert str(install_req.req) == "requests==2.22.0"
150+
assert install_req.link.url == wheel_url
151+
assert install_req.is_wheel
152+
assert install_req.use_pep517 == use_pep517
153+
assert install_req.extras == {"security"}
154+
132155
@pytest.mark.parametrize("use_pep517", [None, True, False])
133156
def test_install_req_from_string_pep508_url_not_a_wheel(
134157
self, use_pep517, tmpdir):

0 commit comments

Comments
 (0)