lister.tests: Add missing task_type for package listers

The scheduler module no longer initializes itself those task_type.
This commit is contained in:
Antoine R. Dumont (@ardumont) 2019-11-21 13:33:16 +01:00
parent 5191d291da
commit 1cf7c8e86b
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8
10 changed files with 104 additions and 22 deletions

View file

@ -1 +1,23 @@
# Copyright (C) 2019 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import pytest
from swh.lister.core.tests.conftest import * # noqa
@pytest.fixture
def lister_pypi(swh_listers):
lister = swh_listers['pypi']
# Add the load-deb-package in the scheduler backend
lister.scheduler.create_task_type({
'type': 'load-pypi',
'description': 'Load PyPI package',
'backend_name': 'swh.loader.package.tasks.LoadPyPI',
'default_interval': '1 day',
})
return lister

View file

@ -4,12 +4,10 @@
# See top-level LICENSE file for more information
def test_pypi_lister(swh_listers, requests_mock_datadir):
lister = swh_listers['pypi']
def test_pypi_lister(lister_pypi, requests_mock_datadir):
lister_pypi.run()
lister.run()
r = lister.scheduler.search_tasks(task_type='load-pypi')
r = lister_pypi.scheduler.search_tasks(task_type='load-pypi')
assert len(r) == 4
for row in r: