Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/debian/tests/conftest.py
# Copyright (C) 2019 The Software Heritage developers | # Copyright (C) 2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import pytest | import pytest | ||||
from swh.lister.core.tests.conftest import * # noqa | from swh.lister.core.tests.conftest import * # noqa | ||||
from swh.lister.debian import debian_init | from swh.lister.debian import debian_init | ||||
@pytest.fixture | @pytest.fixture | ||||
def lister_debian(swh_listers): | def lister_debian(swh_listers): | ||||
lister = swh_listers['debian'] | lister = swh_listers['debian'] | ||||
# Initialize the debian data model | # Initialize debian data model | ||||
debian_init(lister.db_engine, | debian_init(lister.db_engine, | ||||
distributions=['stretch'], | distributions=['stretch'], | ||||
area_names=['main', 'contrib']) | area_names=['main', 'contrib']) | ||||
with pytest.raises(ValueError, | |||||
match='Misconfigured lister'): | |||||
lister.checks() | |||||
# Add the load-deb-package in the scheduler backend | # Add the load-deb-package in the scheduler backend | ||||
lister.scheduler.create_task_type({ | lister.scheduler.create_task_type({ | ||||
'type': 'load-deb-package', | 'type': 'load-deb-package', | ||||
'description': 'Load a Debian package', | 'description': 'Load a Debian package', | ||||
'backend_name': 'swh.loader.debian.tasks.LoaderDebianPackage', | 'backend_name': 'swh.loader.debian.tasks.LoaderDebianPackage', | ||||
'default_interval': '1 day', | 'default_interval': '1 day', | ||||
}) | }) | ||||
# everything is now fine | |||||
lister.checks() | |||||
return lister | return lister |