Skip to content

Commit

Permalink
apt: improve doc+test for get_remote_versions_for_package
Browse files Browse the repository at this point in the history
Those concern the case where we find origins in the local dpkg cache
(installed versions), and ignore them.

Signed-off-by: Renan Rodrigo <[email protected]>
  • Loading branch information
renanrodrigo committed Oct 26, 2023
1 parent 00bf3dc commit 3ffb7f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions uaclient/apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ def get_remote_versions_for_package(
valid_origins = [
file
for file, _ in version.file_list
# component == now means we are getting it from the local dpkg
# cache, and we don't really care about those entries because
# they are the currently installed version of the package.
if file.component != "now" and file.origin != exclude_origin
]
if valid_origins:
Expand Down
4 changes: 3 additions & 1 deletion uaclient/tests/test_apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,9 @@ def test_get_remote_versions_excluding_origin(self):
get_remote_versions_for_package(
mock_package(
"name",
installed_version=mock_version("1.0"),
installed_version=mock_version(
"1.0", [mock_origin("now", "", "Origin1", "")]
),
other_versions=[
mock_version(
"0.9", [mock_origin("", "", "Origin1", "")]
Expand Down

0 comments on commit 3ffb7f6

Please sign in to comment.