Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/debian/tests/conftest.py
# Copyright (C) 2019-2020 The Software Heritage developers | # Copyright (C) 2019-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import os | |||||
import pytest | import pytest | ||||
from pytest_postgresql.janitor import DatabaseJanitor | from pytest_postgresql.janitor import DatabaseJanitor | ||||
from sqlalchemy import create_engine | from sqlalchemy import create_engine | ||||
from sqlalchemy.orm import sessionmaker | from sqlalchemy.orm import sessionmaker | ||||
from swh.core.db.pytest_plugin import postgresql_fact | |||||
from swh.lister.core.models import SQLBase | from swh.lister.core.models import SQLBase | ||||
from swh.lister.debian import debian_init | from swh.lister.debian import debian_init | ||||
import swh.scheduler | |||||
SQL_DIR = os.path.join(os.path.dirname(swh.scheduler.__file__), "sql") | |||||
postgresql_scheduler = postgresql_fact( | |||||
"postgresql_proc", | |||||
db_name="scheduler-lister", | |||||
dump_files=os.path.join(SQL_DIR, "*.sql"), | |||||
# do not truncate the task tables, it's required in between test | |||||
no_truncate_tables={"dbversion", "priority_ratio", "task"}, | |||||
) | |||||
@pytest.fixture | |||||
def swh_scheduler_config(postgresql_scheduler): | |||||
return {"db": postgresql_scheduler.dsn} | |||||
@pytest.fixture | @pytest.fixture | ||||
def lister_under_test(): | def lister_under_test(): | ||||
return "debian" | return "debian" | ||||
@pytest.fixture | @pytest.fixture | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |