mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-15 06:55:48 +00:00
fix error with missing sources
In case if package has local cache it will fail to load because no remote source set. Particially this case can be observed during tree load
This commit is contained in:
@ -5,6 +5,7 @@ from pytest_mock import MockerFixture
|
||||
from ahriman.core.database import SQLite
|
||||
from ahriman.core.tree import Leaf, Tree
|
||||
from ahriman.models.package import Package
|
||||
from ahriman.models.repository_paths import RepositoryPaths
|
||||
|
||||
|
||||
def test_leaf_is_root_empty(leaf_ahriman: Leaf) -> None:
|
||||
@ -37,7 +38,8 @@ def test_leaf_is_root_true(leaf_ahriman: Leaf, leaf_python_schedule: Leaf) -> No
|
||||
assert not leaf_ahriman.is_root([leaf_python_schedule])
|
||||
|
||||
|
||||
def test_leaf_load(package_ahriman: Package, database: SQLite, mocker: MockerFixture) -> None:
|
||||
def test_leaf_load(package_ahriman: Package, repository_paths: RepositoryPaths,
|
||||
database: SQLite, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must load with dependencies
|
||||
"""
|
||||
@ -46,12 +48,12 @@ def test_leaf_load(package_ahriman: Package, database: SQLite, mocker: MockerFix
|
||||
dependencies_mock = mocker.patch("ahriman.models.package.Package.dependencies", return_value={"ahriman-dependency"})
|
||||
rmtree_mock = mocker.patch("shutil.rmtree")
|
||||
|
||||
leaf = Leaf.load(package_ahriman, database)
|
||||
leaf = Leaf.load(package_ahriman, repository_paths, database)
|
||||
assert leaf.package == package_ahriman
|
||||
assert leaf.dependencies == {"ahriman-dependency"}
|
||||
tempdir_mock.assert_called_once_with()
|
||||
load_mock.assert_called_once_with(
|
||||
pytest.helpers.anyvar(int), package_ahriman.remote, database.patches_get(package_ahriman.base))
|
||||
pytest.helpers.anyvar(int), package_ahriman, None, repository_paths)
|
||||
dependencies_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||
rmtree_mock.assert_called_once_with(pytest.helpers.anyvar(int), ignore_errors=True)
|
||||
|
||||
@ -69,8 +71,8 @@ def test_tree_levels(leaf_ahriman: Leaf, leaf_python_schedule: Leaf) -> None:
|
||||
assert second == [leaf_ahriman.package]
|
||||
|
||||
|
||||
def test_tree_load(package_ahriman: Package, package_python_schedule: Package, database: SQLite,
|
||||
mocker: MockerFixture) -> None:
|
||||
def test_tree_load(package_ahriman: Package, package_python_schedule: Package, repository_paths: RepositoryPaths,
|
||||
database: SQLite, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must package list
|
||||
"""
|
||||
@ -79,5 +81,5 @@ def test_tree_load(package_ahriman: Package, package_python_schedule: Package, d
|
||||
mocker.patch("ahriman.models.package.Package.dependencies")
|
||||
mocker.patch("shutil.rmtree")
|
||||
|
||||
tree = Tree.load([package_ahriman, package_python_schedule], database)
|
||||
tree = Tree.load([package_ahriman, package_python_schedule], repository_paths, database)
|
||||
assert len(tree.leaves) == 2
|
||||
|
Reference in New Issue
Block a user