Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_commit_error(transaction):
with raises(error) as excinfo:
transaction.commit()
assert 'transaction failed' in str(excinfo.value)
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)
def test_vercmp_smaller():
assert pyalpm.vercmp('1', '2') == -1
def test_vercmp_greater():
assert pyalpm.vercmp('2', '1') == 1
assert pyalpm.vercmp('2.0-1', '1.7-6') == 1
def test_greater(self):
self.assertEqual(pyalpm.vercmp('2', '1'), 1)
self.assertEqual(pyalpm.vercmp('2.0-1', '1.7-6'), 1)
def test_smaller(self):
self.assertEqual(pyalpm.vercmp('1', '2'), -1)
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]
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]
def test_alpm_version():
assert pyalpm.alpmversion() != ''
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)