allow packages without package function

This commit is contained in:
2024-09-17 03:33:25 +03:00
parent 8bcc3b647e
commit d3da8b11ee
2 changed files with 11 additions and 3 deletions

View File

@ -66,14 +66,14 @@ def test_from_io_empty(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> Non
def test_packages(pkgbuild_ahriman: Pkgbuild) -> None:
"""
must correctly generate load package function
must correctly load package function
"""
assert pkgbuild_ahriman.packages() == {pkgbuild_ahriman["pkgbase"]: Pkgbuild({})}
def test_packages_multi(resource_path_root: Path) -> None:
"""
must correctly generate load list of package functions
must correctly load list of package functions
"""
pkgbuild = Pkgbuild.from_file(resource_path_root / "models" / "package_gcc10_pkgbuild")
packages = pkgbuild.packages()
@ -83,6 +83,14 @@ def test_packages_multi(resource_path_root: Path) -> None:
assert all("depends" in package for package in packages.values())
def test_packages_empty(pkgbuild_ahriman: Pkgbuild) -> None:
"""
must correctly load packages without package functionn
"""
del pkgbuild_ahriman.fields["package()"]
assert pkgbuild_ahriman.packages() == {pkgbuild_ahriman["pkgbase"]: Pkgbuild({})}
def test_getitem(pkgbuild_ahriman: Pkgbuild) -> None:
"""
must return element by key