mirror of
https://github.com/borgbackup/borg.git
synced 2026-02-20 00:10:35 -05:00
tests: add some ctx managers for better cleanup
This commit is contained in:
parent
d6c334c4ec
commit
4aa63a7866
3 changed files with 17 additions and 15 deletions
|
|
@ -514,10 +514,12 @@ def fuse_mount(archiver, mountpoint=None, *options, fork=True, os_fork=False, **
|
|||
# with the call to `cmd`, above.
|
||||
yield
|
||||
return
|
||||
wait_for_mountstate(mountpoint, mounted=True)
|
||||
yield
|
||||
umount(mountpoint)
|
||||
wait_for_mountstate(mountpoint, mounted=False)
|
||||
os.rmdir(mountpoint)
|
||||
try:
|
||||
wait_for_mountstate(mountpoint, mounted=True)
|
||||
yield
|
||||
finally:
|
||||
umount(mountpoint)
|
||||
wait_for_mountstate(mountpoint, mounted=False)
|
||||
os.rmdir(mountpoint)
|
||||
# Give the daemon some time to exit
|
||||
time.sleep(0.2)
|
||||
|
|
|
|||
|
|
@ -86,11 +86,11 @@ def test_access_acl():
|
|||
|
||||
@skipif_acls_not_working
|
||||
def test_default_acl():
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
assert get_acl(tmpdir) == {}
|
||||
set_acl(tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
|
||||
assert get_acl(tmpdir)["acl_access"] == ACCESS_ACL
|
||||
assert get_acl(tmpdir)["acl_default"] == DEFAULT_ACL
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
assert get_acl(tmpdir) == {}
|
||||
set_acl(tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
|
||||
assert get_acl(tmpdir)["acl_access"] == ACCESS_ACL
|
||||
assert get_acl(tmpdir)["acl_default"] == DEFAULT_ACL
|
||||
|
||||
|
||||
# nfs4 acls testing not implemented.
|
||||
|
|
|
|||
|
|
@ -72,11 +72,11 @@ def test_access_acl():
|
|||
|
||||
@skipif_acls_not_working
|
||||
def test_default_acl():
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
assert get_acl(tmpdir) == {}
|
||||
set_acl(tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
|
||||
assert get_acl(tmpdir)["acl_access"] == ACCESS_ACL
|
||||
assert get_acl(tmpdir)["acl_default"] == DEFAULT_ACL
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
assert get_acl(tmpdir) == {}
|
||||
set_acl(tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
|
||||
assert get_acl(tmpdir)["acl_access"] == ACCESS_ACL
|
||||
assert get_acl(tmpdir)["acl_default"] == DEFAULT_ACL
|
||||
|
||||
|
||||
@skipif_acls_not_working
|
||||
|
|
|
|||
Loading…
Reference in a new issue