lister.tests: Avoid duplication setup step
And remove unnecessary fixture redefinition which causes indirection.
This commit is contained in:
parent
3ddfd00e90
commit
cb853f4898
5 changed files with 18 additions and 40 deletions
|
@ -3,21 +3,4 @@
|
|||
# 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_cran(swh_listers):
|
||||
lister = swh_listers['cran']
|
||||
|
||||
# Add the load-deb-package in the scheduler backend
|
||||
lister.scheduler.create_task_type({
|
||||
'type': 'load-archive-files',
|
||||
'description': 'Load archive files.',
|
||||
'backend_name': 'swh.loader.package.tasks.LoadArchive',
|
||||
'default_interval': '1 day',
|
||||
})
|
||||
|
||||
return lister
|
||||
|
|
|
@ -28,16 +28,18 @@ def test_cran_compute_package_url_failure():
|
|||
|
||||
|
||||
@patch('swh.lister.cran.lister.read_cran_data')
|
||||
def test_cran_lister_cran(mock_cran, datadir, lister_cran):
|
||||
def test_cran_lister_cran(mock_cran, datadir, swh_listers):
|
||||
lister = swh_listers['cran']
|
||||
|
||||
with open(path.join(datadir, 'list-r-packages.json')) as f:
|
||||
data = json.loads(f.read())
|
||||
|
||||
mock_cran.return_value = data
|
||||
assert len(data) == 6
|
||||
|
||||
lister_cran.run()
|
||||
lister.run()
|
||||
|
||||
r = lister_cran.scheduler.search_tasks(task_type='load-archive-files')
|
||||
r = lister.scheduler.search_tasks(task_type='load-archive-files')
|
||||
assert len(r) == 6
|
||||
|
||||
for row in r:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue