def test_clean_command():
fake_metadata_cache = NamedTemporaryFile(delete=False)
fake_blob_cache = NamedTemporaryFile(delete=False)
config = {
"cache": {
"metadata": {"path": fake_metadata_cache.name},
"blob": {"path": fake_blob_cache.name},
},
}
with NamedTemporaryFile(suffix=".yml") as config_path:
Path(config_path.name).write_text(yaml.dump(config))
res = CliRunner().invoke(
cli.fuse, args=["--config-file", config_path.name, "clean",],
> catch_exceptions=False,
)
.tox/py3/lib/python3.7/site-packages/swh/fuse/tests/test_cli.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/click/testing.py:329: in invoke
cli.main(args=args or (), prog_name=prog_name, **extra)
.tox/py3/lib/python3.7/site-packages/click/core.py:782: in main
rv = self.invoke(ctx)
.tox/py3/lib/python3.7/site-packages/click/core.py:1259: in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
.tox/py3/lib/python3.7/site-packages/click/core.py:1066: in invoke
return ctx.invoke(self.callback, **ctx.params)
.tox/py3/lib/python3.7/site-packages/click/core.py:610: in invoke
return callback(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/click/decorators.py:21: in new_func
return f(get_current_context(), *args, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/fuse/cli.py:203: in clean
rm_cache(conf, cache_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
conf = {'cache': {'blob': {'path': '/tmp/tmpxgamtcrj'}, 'direntry': {'maxram': '10%'}, 'metadata': {'path': '/tmp/tmpn466gx8i'}}, 'json-indent': 2, 'web-api': {'auth-token': None, 'url': 'https://archive.softwareheritage.org/api/1'}}
cache_name = 'blob'
def rm_cache(conf, cache_name):
try:
> Path(conf["cache"][cache_name]["path"]).unlink(missing_ok=True)
E TypeError: unlink() got an unexpected keyword argument 'missing_ok'
.tox/py3/lib/python3.7/site-packages/swh/fuse/cli.py:197: TypeError
TEST RESULT
TEST RESULT
- Run At
- Dec 1 2020, 4:51 PM