mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-16 07:19:57 +00:00
fix: trim provides/depends versions and lookup provides through pkgname
(#150) Current implementation did it in wrong way. First of all, there was a lookup through pkgbase instead of pkgname, which lead to errors, because aur api doesn't allow to search by pkgbase (as well as provides is basically pkgname instead) It also was found that dependencies resolution lookup has been performed by using raw packages array, which can include versions, descriptions etc
This commit is contained in:
@ -289,3 +289,4 @@ def test_package_provided_by(pacman: Pacman) -> None:
|
||||
must search through the provides lists
|
||||
"""
|
||||
assert list(pacman.provided_by("sh"))
|
||||
assert list(pacman.provided_by("libacl.so")) # case with exact version
|
||||
|
@ -2,7 +2,7 @@ import datetime
|
||||
import json
|
||||
import pyalpm # typing: ignore
|
||||
|
||||
from dataclasses import asdict, fields
|
||||
from dataclasses import asdict, fields, replace
|
||||
from pathlib import Path
|
||||
from pytest_mock import MockerFixture
|
||||
from typing import Any
|
||||
@ -38,6 +38,25 @@ def _get_official_data(resource_path_root: Path) -> dict[str, Any]:
|
||||
return json.loads(response)["results"][0]
|
||||
|
||||
|
||||
def test_post_init(aur_package_ahriman: AURPackage) -> None:
|
||||
"""
|
||||
must trim versions and descriptions from packages list
|
||||
"""
|
||||
package = replace(
|
||||
aur_package_ahriman,
|
||||
depends=["a=1"],
|
||||
make_depends=["b>=3"],
|
||||
opt_depends=["c: a description"],
|
||||
check_depends=["d=4"],
|
||||
provides=["e=5"],
|
||||
)
|
||||
assert package.depends == ["a"]
|
||||
assert package.make_depends == ["b"]
|
||||
assert package.opt_depends == ["c"]
|
||||
assert package.check_depends == ["d"]
|
||||
assert package.provides == ["e"]
|
||||
|
||||
|
||||
def test_from_json(aur_package_ahriman: AURPackage, resource_path_root: Path) -> None:
|
||||
"""
|
||||
must load package from json
|
||||
|
@ -6,10 +6,15 @@ from ahriman.models.package_description import PackageDescription
|
||||
|
||||
def test_post_init() -> None:
|
||||
"""
|
||||
must trim versions and descriptions from dependencies list
|
||||
must trim versions and descriptions from packages list
|
||||
"""
|
||||
assert PackageDescription(depends=["a=1"], make_depends=["b>=3"], opt_depends=["c: a description"]) == \
|
||||
PackageDescription(depends=["a"], make_depends=["b"], opt_depends=["c"])
|
||||
assert PackageDescription(
|
||||
depends=["a=1"],
|
||||
make_depends=["b>=3"],
|
||||
opt_depends=["c: a description"],
|
||||
check_depends=["d=4"],
|
||||
provides=["e=5"]
|
||||
) == PackageDescription(depends=["a"], make_depends=["b"], opt_depends=["c"], check_depends=["d"], provides=["e"])
|
||||
|
||||
|
||||
def test_filepath(package_description_ahriman: PackageDescription) -> None:
|
||||
|
Reference in New Issue
Block a user