diff --git a/swh/fuse/tests/conftest.py b/swh/fuse/tests/conftest.py --- a/swh/fuse/tests/conftest.py +++ b/swh/fuse/tests/conftest.py @@ -32,7 +32,6 @@ @pytest.fixture def fuse_mntdir(web_api_mock): tmpdir = TemporaryDirectory(suffix=".swh-fuse-test") - tmpfile = NamedTemporaryFile(suffix=".swh-fuse-test.yml") config = { "cache": {"metadata": {"in-memory": True}, "blob": {"in-memory": True},}, @@ -42,9 +41,9 @@ # 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(tmpdir, tmpfile): - with tmpdir as mntdir, tmpfile as config_path: - config_path = Path(config_path.name) + 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, @@ -52,12 +51,12 @@ "--config-file", str(config_path), "mount", - mntdir, + str(mntdir), "--foreground", ], ) - fuse = Process(target=fuse_process, args=[tmpdir, tmpfile]) + 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):