How to use pyalpm - 10 common examples

To help you get started, we’ve selected a few pyalpm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github archlinux / pyalpm / test / test_transaction.py View on Github external
def test_commit_error(transaction):
    with raises(error) as excinfo:
        transaction.commit()
    assert 'transaction failed' in str(excinfo.value)
github archlinux / pyalpm / test / test_alpm.py View on Github external
def test_find_satisfier_error():
    with pytest.raises(TypeError) as excinfo:
        pyalpm.find_satisfier()
    assert 'takes a Package list and a string' in str(excinfo.value)

    with pytest.raises(TypeError) as excinfo:
        pyalpm.find_satisfier(["foo"], PKG)
    assert 'list must contain only Package objects' in str(excinfo.value)
github archlinux / pyalpm / test / test_alpm.py View on Github external
def test_vercmp_smaller():
    assert pyalpm.vercmp('1', '2') == -1
github archlinux / pyalpm / test / test_alpm.py View on Github external
def test_vercmp_greater():
    assert pyalpm.vercmp('2', '1') == 1
    assert pyalpm.vercmp('2.0-1', '1.7-6') == 1
github archlinux / pyalpm / test / test_vercmp.py View on Github external
def test_greater(self):
        self.assertEqual(pyalpm.vercmp('2', '1'), 1)
        self.assertEqual(pyalpm.vercmp('2.0-1', '1.7-6'), 1)
github archlinux / pyalpm / test / test_vercmp.py View on Github external
def test_smaller(self):
        self.assertEqual(pyalpm.vercmp('1', '2'), -1)
github archlinux / pyalpm / test / test_refcounting.py View on Github external
def get_find_grp_pkgs():
    handle = Handle('/', '/tmp/')
    repo = handle.register_syncdb(REPO_1, 0)
    repo.servers = [TEST_MIRROR.format(REPO_1, ARCH)]
    db = handle.get_syncdbs()[0]
    db.update(False)
    return find_grp_pkgs([db], "base")[0]
github archlinux / pyalpm / test / test_refcounting.py View on Github external
def get_syncdb():
    # Return syncdb, so handle should go out of scope
    handle = Handle('/', '/tmp/')
    repo = handle.register_syncdb(REPO_1, 0)
    repo.servers = [TEST_MIRROR.format(REPO_1, ARCH)]
    return handle.get_syncdbs()[0]
github archlinux / pyalpm / test / test_alpm.py View on Github external
def test_alpm_version():
    assert pyalpm.alpmversion() != ''
github archlinux / pyalpm / test / test_handle.py View on Github external
def test_set_pkgreason(handle, package):
    with raises(pyalpm.error) as excinfo:
        handle.set_pkgreason(package, -1)
    assert 'failed setting install reason' in str(excinfo.value)