Skip to content

Commit

Permalink
[ENTRY][Packages] Add support for snap and flatpak packages count
Browse files Browse the repository at this point in the history
  • Loading branch information
cinghioGithub committed May 8, 2024
1 parent 5623949 commit 3c426c6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions archey/entries/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def get_homebrew_cellar_path() -> str:
{"tool": "slackware", "cmd": ("ls", "-1", "/var/log/packages/")}, # SlackWare.
{"tool": "yum", "cmd": ("yum", "list", "installed"), "skew": 2},
{"tool": "zypper", "cmd": ("zypper", "search", "-i"), "skew": 5},
{"tool": "snap", "cmd": ("snap", "list", "--all"), "skew": 1},
{"tool": "flatpak", "cmd": ("flatpak", "list"), "skew": 1},
)


Expand Down
33 changes: 33 additions & 0 deletions archey/test/entries/test_archey_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,39 @@ def test_match_with_zypper(self, check_output_mock):

self.assertEqual(Packages().value, '(zypper) 5')

@patch(
"archey.entries.packages.check_output",
return_value="""\
Name Version Rev Tracking Publisher Notes
gnome-3-38-2004 0+git.efb213a 143 latest/stable/… canonical✓ -
gnome-42-2204 0+git.510a601 176 latest/stable canonical✓ -
gtk-common-themes 0.1-81-g442e511 1535 latest/stable/… canonical✓ -
snap-store 41.3-66-gfe1e325 638 latest/stable/… canonical✓ -
""",
)
def test_match_with_snap(self, check_output_mock):
"""Simple test for the Snap packages manager"""
check_output_mock.side_effect = self._check_output_side_effect("snap")

self.assertEqual(Packages().value, '(snap) 4')


@patch(
"archey.entries.packages.check_output",
return_value="""\
Name Application ID Version Branch Origin Installation
Discord com.discordapp.Discord 0.0.35 stable flathub system
Xournal++ com.github.xournalpp.xournalpp 1.2.2 stable flathub system
draw.io com.jgraph.drawio.desktop 22.0.2 stable flathub system
Extension Manager com.mattjakeman.ExtensionManager 0.4.2 stable flathub system
""",
)
def test_match_with_flatpak(self, check_output_mock):
"""Simple test for the Flatpak packages manager"""
check_output_mock.side_effect = self._check_output_side_effect("flatpak")

self.assertEqual(Packages().value, '(flatpak) 4')

@patch(
"archey.entries.packages.PACKAGES_TOOLS",
new=(
Expand Down

0 comments on commit 3c426c6

Please sign in to comment.