mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Fix manifest URL requirement install check (#155664)
This commit is contained in:
@@ -86,6 +86,10 @@ def is_installed(requirement_str: str) -> bool:
|
||||
"Installed version for %s resolved to None", req.name
|
||||
)
|
||||
return False
|
||||
if req.url:
|
||||
# If requirement is a URL, we cannot verify versions, so let
|
||||
# the package manager handle it
|
||||
return False
|
||||
return req.specifier.contains(installed_version, prereleases=True)
|
||||
except PackageNotFoundError:
|
||||
return False
|
||||
|
||||
@@ -400,6 +400,11 @@ def test_get_is_installed() -> None:
|
||||
assert package.is_installed(f"{installed_package}<={installed_version}")
|
||||
assert not package.is_installed(f"{installed_package}<{installed_version}")
|
||||
|
||||
# URL-based requirements should always return False, as no version check is possible
|
||||
assert not package.is_installed(
|
||||
"homeassistant@git+https://github.com/home-assistant/core.git@dev"
|
||||
)
|
||||
|
||||
|
||||
def test_check_package_previous_failed_install() -> None:
|
||||
"""Test for when a previously install package failed and left cruft behind."""
|
||||
|
||||
Reference in New Issue
Block a user