Add testcases for pacman

This commit is contained in:
Felix Yan 2015-11-05 20:47:46 +08:00
parent 7065df1b32
commit 5bde44a3c2
2 changed files with 14 additions and 1 deletions

View File

@ -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

13
tests/test_pacman.py Normal file
View File

@ -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")