web_api_mock = <requests_mock.mocker.Mocker object at 0x7f31888a6ac8>
@pytest.fixture
def fuse_mntdir(web_api_mock):
tmpdir = TemporaryDirectory(suffix=".swh-fuse-test")
config = {
"cache": {"metadata": {"in-memory": True}, "blob": {"in-memory": True},},
"web-api": {"url": API_URL, "auth-token": None},
"json-indent": None,
}
# Run FUSE in foreground mode but in a separate process, so it does not
# block execution and remains easy to kill during teardown
def fuse_process(mntdir: Path):
with NamedTemporaryFile(suffix=".swh-fuse-test.yml") as tmpfile:
config_path = Path(tmpfile.name)
config_path.write_text(yaml.dump(config))
CliRunner().invoke(
cli.fuse,
args=[
"--config-file",
str(config_path),
"mount",
str(mntdir),
"--foreground",
],
)
fuse = Process(target=fuse_process, args=[Path(tmpdir.name)])
fuse.start()
# Wait max 3 seconds for the FUSE to correctly mount
for i in range(30):
try:
root = os.listdir(tmpdir.name)
if root:
break
except FileNotFoundError:
pass
time.sleep(0.1)
else:
> raise FileNotFoundError(f"Could not mount FUSE in {tmpdir.name}")
E FileNotFoundError: Could not mount FUSE in /tmp/tmp5t06ghpq.swh-fuse-test
.tox/py3/lib/python3.7/site-packages/swh/fuse/tests/conftest.py:76: FileNotFoundError
TEST RESULT
TEST RESULT
- Run At
- Mar 4 2021, 3:30 PM