Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/tests/test_cli.py
Show First 20 Lines • Show All 573 Lines • ▼ Show 20 Lines | def _fill_storage_with_origins(storage, nb_origins): | ||||
storage.origin_add(origins) | storage.origin_add(origins) | ||||
return origins | return origins | ||||
@pytest.fixture | @pytest.fixture | ||||
def storage(): | def storage(): | ||||
"""An instance of in-memory storage that gets injected | """An instance of in-memory storage that gets injected | ||||
into the CLI functions.""" | into the CLI functions.""" | ||||
storage = get_storage('memory') | storage_config = { | ||||
'cls': 'pipeline', | |||||
'steps': [ | |||||
{'cls': 'validate'}, | |||||
{'cls': 'memory'}, | |||||
] | |||||
} | |||||
storage = get_storage(**storage_config) | |||||
with patch('swh.storage.get_storage') as get_storage_mock: | with patch('swh.storage.get_storage') as get_storage_mock: | ||||
get_storage_mock.return_value = storage | get_storage_mock.return_value = storage | ||||
yield storage | yield storage | ||||
@patch('swh.scheduler.cli.utils.TASK_BATCH_SIZE', 3) | @patch('swh.scheduler.cli.utils.TASK_BATCH_SIZE', 3) | ||||
def test_task_schedule_origins_dry_run( | def test_task_schedule_origins_dry_run( | ||||
swh_scheduler, storage): | swh_scheduler, storage): | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |