swh_loader_config = {'deposit': {'auth': {'password': 'pass', 'username': 'user'}, 'url': 'https://deposit.softwareheritage.org/1/private'}, 'storage': {'cls': 'memory'}}
def test_get_loader(swh_loader_config):
"""Instantiating a supported loader should be ok
"""
loader_input = {
"archive": {"url": "some-url", "artifacts": []},
"debian": {"url": "some-url", "date": "something", "packages": [],},
"npm": {"url": "https://www.npmjs.com/package/onepackage",},
"pypi": {"url": "some-url",},
}
for loader_type, kwargs in loader_input.items():
kwargs["storage"] = swh_loader_config["storage"]
> loader = get_loader(loader_type, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/loader/tests/test_cli.py:41:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/loader/cli.py:51: in get_loader
return loader_cls.from_config(**kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'swh.loader.package.debian.loader.DebianLoader'>
storage = {'cls': 'memory'}
config = {'date': 'something', 'packages': [], 'url': 'some-url'}
legacy_key = 'celery'
storage_instance = <swh.storage.in_memory.InMemoryStorage object at 0x7f3b5df8a0b8>
@classmethod
def from_config(cls, storage: Dict[str, Any], **config: Any):
"""Instantiate a loader from a configuration dict.
This is basically a backwards-compatibility shim for the CLI.
Args:
storage: instantiation config for the storage
config: the configuration dict for the loader, with the following keys:
- credentials (optional): credentials list for the scheduler
- any other kwargs passed to the loader.
Returns:
the instantiated loader
"""
# Drop the legacy config keys which aren't used for this generation of loader.
for legacy_key in ("storage", "celery"):
config.pop(legacy_key, None)
# Instantiate the storage
storage_instance = get_storage(**storage)
> return cls(storage=storage_instance, **config)
E TypeError: __init__() got an unexpected keyword argument 'date'
.tox/py3/lib/python3.7/site-packages/swh/loader/core/loader.py:123: TypeError
TEST RESULT
TEST RESULT
- Run At
- Dec 3 2021, 11:20 AM