Skip to content

Commit 9ced6ca

Browse files
committed
Kill filesystem process on test cleanup.
1 parent de11ec0 commit 9ced6ca

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

test/test_sshfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, capfd):
109109
tst_truncate_fd(mnt_dir)
110110
tst_open_unlink(mnt_dir)
111111
except:
112-
cleanup(mnt_dir)
112+
cleanup(mount_process, mnt_dir)
113113
raise
114114
else:
115115
umount(mount_process, mnt_dir)

test/util.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ def wait_for_mount(mount_process, mnt_dir,
2020
elapsed += 0.1
2121
pytest.fail("mountpoint failed to come up")
2222

23-
def cleanup(mnt_dir):
23+
def cleanup(mount_process, mnt_dir):
2424
subprocess.call(['fusermount', '-z', '-u', mnt_dir],
2525
stdout=subprocess.DEVNULL,
2626
stderr=subprocess.STDOUT)
27+
mount_process.terminate()
28+
try:
29+
mount_process.wait(1)
30+
except subprocess.TimeoutExpired:
31+
mount_process.kill()
32+
2733

2834
def umount(mount_process, mnt_dir):
2935
subprocess.check_call(['fusermount', '-z', '-u', mnt_dir ])

0 commit comments

Comments
 (0)