diff --git a/swh/lister/pytest_plugin.py b/swh/lister/pytest_plugin.py --- a/swh/lister/pytest_plugin.py +++ b/swh/lister/pytest_plugin.py @@ -45,11 +45,21 @@ @pytest.fixture -def swh_listers(mock_get_scheduler, lister_db_url, swh_scheduler): +def listers_to_instantiate(): + """Fixture to define what listers to instantiate. Because some need dedicated setup. + + """ + return set(SUPPORTED_LISTERS) - {"launchpad"} + + +@pytest.fixture +def swh_listers( + mock_get_scheduler, lister_db_url, swh_scheduler, listers_to_instantiate +): listers = {} # Prepare schema for all listers - for lister_name in SUPPORTED_LISTERS: + for lister_name in listers_to_instantiate: lister = get_lister(lister_name, db_url=lister_db_url) listers[lister_name] = lister initialize(create_engine(lister_db_url), drop_tables=True) diff --git a/swh/lister/tests/test_cli.py b/swh/lister/tests/test_cli.py --- a/swh/lister/tests/test_cli.py +++ b/swh/lister/tests/test_cli.py @@ -7,7 +7,7 @@ from swh.lister.core.lister_base import ListerBase -from swh.lister.cli import get_lister, SUPPORTED_LISTERS +from swh.lister.cli import get_lister from .test_utils import init_db @@ -20,14 +20,12 @@ assert "Invalid lister" in str(e.value) -def test_get_lister(mock_get_scheduler): +def test_get_lister(mock_get_scheduler, listers_to_instantiate): """Instantiating a supported lister should be ok """ db_url = init_db().url() - # launchpad lister need particular setup so exclude from the checks - listers_to_check = set(SUPPORTED_LISTERS) | {"launchpad"} - for lister_name in listers_to_check: + for lister_name in listers_to_instantiate: lst = get_lister(lister_name, db_url) assert isinstance(lst, ListerBase)