Skip to content

Commit

Permalink
Kill filesystem process on test cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikratio committed Dec 22, 2018
1 parent de11ec0 commit 9ced6ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/test_sshfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion test/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ])
Expand Down

0 comments on commit 9ced6ca

Please sign in to comment.