From 9ced6ca681050ac9d5ee8961a75d86cd508cf1e3 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Sun, 18 Nov 2018 17:12:40 +0000 Subject: Kill filesystem process on test cleanup. --- test/test_sshfs.py | 2 +- test/util.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/test_sshfs.py b/test/test_sshfs.py index 04366fe..08091bd 100755 --- a/test/test_sshfs.py +++ b/test/test_sshfs.py @@ -109,7 +109,7 @@ def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, capfd): tst_truncate_fd(mnt_dir) tst_open_unlink(mnt_dir) except: - cleanup(mnt_dir) + cleanup(mount_process, mnt_dir) raise else: umount(mount_process, mnt_dir) diff --git a/test/util.py b/test/util.py index f2a485c..34f1049 100644 --- a/test/util.py +++ b/test/util.py @@ -20,10 +20,16 @@ def wait_for_mount(mount_process, mnt_dir, elapsed += 0.1 pytest.fail("mountpoint failed to come up") -def cleanup(mnt_dir): +def cleanup(mount_process, mnt_dir): subprocess.call(['fusermount', '-z', '-u', mnt_dir], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) + mount_process.terminate() + try: + mount_process.wait(1) + except subprocess.TimeoutExpired: + mount_process.kill() + def umount(mount_process, mnt_dir): subprocess.check_call(['fusermount', '-z', '-u', mnt_dir ]) -- cgit v1.2.3