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:
Antoine R. Dumont (@ardumont) 2020-09-02 09:47:12 +02:00
parent 92422dcf75
commit 5a5b7ef70b
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8
14 changed files with 127 additions and 87 deletions

View file

@ -14,14 +14,19 @@ from swh.lister.debian import debian_init
@pytest.fixture
def lister_debian(swh_listers):
lister = swh_listers["debian"]
def lister_under_test():
return "debian"
@pytest.fixture
def lister_debian(swh_lister):
# Initialize the debian data model
debian_init(lister.db_engine, suites=["stretch"], components=["main", "contrib"])
debian_init(
swh_lister.db_engine, suites=["stretch"], components=["main", "contrib"]
)
# Add the load-deb-package in the scheduler backend
lister.scheduler.create_task_type(
swh_lister.scheduler.create_task_type(
{
"type": "load-deb-package",
"description": "Load a Debian package",
@ -30,7 +35,7 @@ def lister_debian(swh_listers):
}
)
return lister
return swh_lister
@pytest.fixture