Drop mock_get_scheduler which creates indirection for no good reason
This is no longer useful, as removing it and tests are still ok.
This commit is contained in:
parent
2ff92ef406
commit
30ad6200a2
3 changed files with 2 additions and 22 deletions
18
conftest.py
18
conftest.py
|
@ -5,24 +5,6 @@
|
|||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
pytest_plugins = ["swh.scheduler.pytest_plugin", "swh.lister.pytest_plugin"]
|
||||
|
||||
os.environ["LC_ALL"] = "C.UTF-8"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_get_scheduler(monkeypatch, swh_scheduler):
|
||||
"""Override the get_scheduler function in swh.lister.core.lister_base, to
|
||||
return the swh_scheduler fixture.
|
||||
"""
|
||||
from swh.lister.core import lister_base
|
||||
|
||||
# Match the signature from swh.scheduler.get_scheduler
|
||||
def get_scheduler(cls, args={}):
|
||||
return swh_scheduler
|
||||
|
||||
monkeypatch.setattr(lister_base, "get_scheduler", get_scheduler)
|
||||
|
||||
yield monkeypatch
|
||||
|
|
|
@ -54,9 +54,7 @@ def swh_config(swh_lister_config, monkeypatch, tmp_path):
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def swh_lister(
|
||||
mock_get_scheduler, lister_db_url, swh_scheduler, lister_under_test, swh_config
|
||||
):
|
||||
def swh_lister(lister_db_url, swh_scheduler, lister_under_test, swh_config):
|
||||
assert lister_under_test in SUPPORTED_LISTERS
|
||||
lister = get_lister(lister_under_test, db_url=lister_db_url)
|
||||
initialize(create_engine(lister_db_url), drop_tables=True)
|
||||
|
|
|
@ -19,7 +19,7 @@ def test_get_lister_wrong_input():
|
|||
assert "Invalid lister" in str(e.value)
|
||||
|
||||
|
||||
def test_get_lister(mock_get_scheduler):
|
||||
def test_get_lister():
|
||||
"""Instantiating a supported lister should be ok
|
||||
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue