def test_get_lister_override():
"""Overriding the lister configuration should populate its config
"""
db_url = init_db().url()
listers = {
"gitlab": "https://other.gitlab.uni/api/v4/",
"cgit": "https://some.where/cgit",
}
# check the override ends up defined in the lister
for lister_name, url in listers.items():
lst = get_lister(
> lister_name, db_url, url=url, priority="high", policy="oneshot"
)
.tox/py3/lib/python3.7/site-packages/swh/lister/tests/test_cli.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lister_name = 'cgit', db_url = 'postgresql://postgres@127.0.0.1:33257/test'
conf = {'lister': {'args': {'db': 'postgresql://postgres@127.0.0.1:33257/test'}, 'cls': 'local'}, 'policy': 'oneshot', 'priority': 'high', 'url': 'https://some.where/cgit'}
registry_entry = {'lister': <class 'swh.lister.cgit.lister.CGitLister'>, 'task_modules': ['swh.lister.cgit.tasks']}
lister_cls = <class 'swh.lister.cgit.lister.CGitLister'>
def get_lister(lister_name, db_url=None, **conf):
"""Instantiate a lister given its name.
Args:
lister_name (str): Lister's name
conf (dict): Configuration dict (lister db cnx, policy, priority...)
Returns:
Tuple (instantiated lister, drop_tables function, init schema function,
insert minimum data function)
"""
if lister_name not in LISTERS:
raise ValueError(
"Invalid lister %s: only supported listers are %s"
% (lister_name, SUPPORTED_LISTERS)
)
if db_url:
conf["lister"] = {"cls": "local", "args": {"db": db_url}}
registry_entry = LISTERS[lister_name].load()()
lister_cls = registry_entry["lister"]
if issubclass(lister_cls, pattern.Lister):
> return lister_cls.from_config(**conf)
E TypeError: from_config() missing 1 required positional argument: 'scheduler'
.tox/py3/lib/python3.7/site-packages/swh/lister/__init__.py:57: TypeError
TEST RESULT
TEST RESULT
- Run At
- Jan 22 2021, 3:56 PM