Skip to content

Commit

Permalink
tests: Add test of warning of not recording VCS info with legacy 'set…
Browse files Browse the repository at this point in the history
…up.py install'
  • Loading branch information
Noah Gorny committed Sep 16, 2021
1 parent 786b0df commit d841b46
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/unit/test_req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pip._vendor.packaging.requirements import Requirement

from pip._internal.exceptions import InstallationError
from pip._internal.models.link import Link
from pip._internal.req.constructors import (
install_req_from_line,
install_req_from_req_string,
Expand Down Expand Up @@ -106,3 +107,26 @@ def test_install_req_from_string_with_comes_from_without_link(self):
assert install_req.link.url == wheel_url
assert install_req.req.url == wheel_url
assert install_req.is_wheel

def test_install_req_vcs_without_wheel_warning(self, caplog):
"""
Test to make sure that installing from VCS without wheel generates
a warning.
"""
req = InstallRequirement(
Requirement("gputil==1.4.0"),
comes_from=[],
link=Link("git+https://github.com/llamafilm/gputil")
)

req.source_dir = os.curdir
req.install([])

actual = [(r.levelname, r.message) for r in caplog.records]
expected = (
'WARNING',
"Direct URL of package 'gputil' will not be recorded when using"
" legacy 'setup.py install'.\n"
"Consider installing the 'wheel' package."
)
assert expected in actual

0 comments on commit d841b46

Please sign in to comment.