Page MenuHomeSoftware Heritage

D2232.diff
No OneTemporary

D2232.diff

diff --git a/swh/lister/cli.py b/swh/lister/cli.py
--- a/swh/lister/cli.py
+++ b/swh/lister/cli.py
@@ -54,17 +54,15 @@
from swh.core import config
ctx.ensure_object(dict)
- override_conf = {}
+ if not config_file:
+ config_file = os.environ.get('SWH_CONFIG_FILENAME')
+ conf = config.read(config_file)
if db_url:
- override_conf['lister'] = {
+ conf['lister'] = {
'cls': 'local',
'args': {'db': db_url}
}
- if not config_file:
- config_file = os.environ.get('SWH_CONFIG_FILENAME')
- conf = config.read(config_file, override_conf)
ctx.obj['config'] = conf
- ctx.obj['override_conf'] = override_conf
@lister.command(name='db-init', context_settings=CONTEXT_SETTINGS)
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
@@ -98,21 +98,22 @@
def test_task_types(swh_scheduler_config, tmp_path):
- db_url = init_db().url()
-
configfile = tmp_path / 'config.yml'
- configfile.write_text(yaml.dump({'scheduler': {
- 'cls': 'local',
- 'args': swh_scheduler_config}}))
+ config = {
+ 'scheduler': {
+ 'cls': 'local',
+ 'args': swh_scheduler_config
+ }
+ }
+ configfile.write_text(yaml.dump(config))
runner = CliRunner()
result = runner.invoke(cli, [
- '--db-url', db_url,
'--config-file', configfile.as_posix(),
'register-task-types'])
assert result.exit_code == 0, traceback.print_exception(*result.exc_info)
- scheduler = get_scheduler(cls='local', args=swh_scheduler_config)
+ scheduler = get_scheduler(**config['scheduler'])
all_tasks = [
'list-bitbucket-full', 'list-bitbucket-incremental',
'list-cran',
@@ -125,7 +126,7 @@
'list-phabricator-full',
'list-packagist',
'list-pypi',
- ]
+ ]
for task in all_tasks:
task_type_desc = scheduler.get_task_type(task)
assert task_type_desc

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 2, 10:53 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221722

Event Timeline