diff --git a/nvchecker/source/pacman.py b/nvchecker/source/pacman.py index b9c43b3..baf12f8 100644 --- a/nvchecker/source/pacman.py +++ b/nvchecker/source/pacman.py @@ -1,7 +1,7 @@ from . import cmd def get_version(name, conf, callback): - referree = conf['pacman'] + referree = conf.get('pacman') or name c = "LANG=C pacman -Si %s | grep -F Version | awk '{print $3}'" % referree conf['cmd'] = c diff --git a/tests/test_pacman.py b/tests/test_pacman.py new file mode 100644 index 0000000..62b8d2e --- /dev/null +++ b/tests/test_pacman.py @@ -0,0 +1,13 @@ +import shutil +import pytest +from tests.helper import ExternalVersionTestCase + + +@pytest.mark.skipif(shutil.which("pacman") is None, + reason="requires pacman command") +class PacmanTest(ExternalVersionTestCase): + def test_pacman(self): + self.assertEqual(self.sync_get_version("ipw2100-fw", {"pacman": None}), "1.3-7") + + def test_pacman_strip_release(self): + self.assertEqual(self.sync_get_version("ipw2100-fw", {"pacman": None, "strip-release": 1}), "1.3")