tests: Separate lister instantiations
Prior to this commit, all listers were instantiated at the same time even if only one was needed. This commit separates those instantiations. The only drawback to this is the db model initialization which now happens at each lister instantiation. This can be dealt with if needed at another time though.
This commit is contained in:
parent
92422dcf75
commit
5a5b7ef70b
14 changed files with 127 additions and 87 deletions
|
@ -7,7 +7,7 @@ import pytest
|
|||
|
||||
|
||||
from swh.lister.core.lister_base import ListerBase
|
||||
from swh.lister.cli import get_lister
|
||||
from swh.lister.cli import get_lister, SUPPORTED_LISTERS
|
||||
|
||||
from .test_utils import init_db
|
||||
|
||||
|
@ -20,11 +20,14 @@ def test_get_lister_wrong_input():
|
|||
assert "Invalid lister" in str(e.value)
|
||||
|
||||
|
||||
def test_get_lister(mock_get_scheduler, listers_to_instantiate):
|
||||
def test_get_lister(mock_get_scheduler):
|
||||
"""Instantiating a supported lister should be ok
|
||||
|
||||
"""
|
||||
db_url = init_db().url()
|
||||
# exclude listers because they need special instantiation treatment unrelated to
|
||||
# this test (launchpad: network mock, gnu: scheduler load task)
|
||||
listers_to_instantiate = set(SUPPORTED_LISTERS) - {"launchpad", "gnu"}
|
||||
for lister_name in listers_to_instantiate:
|
||||
lst = get_lister(lister_name, db_url)
|
||||
assert isinstance(lst, ListerBase)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue