+
+def test_lock():
+ soft_unlink(lockfile)
+ with LockDirectory(lockfile):
+ pass
+
+def test_locked():
+ soft_unlink(lockfile)
+ with LockDirectory(lockfile):
+ try:
+ with LockDirectory(lockfile):
+ assert False
+ except DirectoryLockedError:
+ pass
+
+def test_break_orphan_lock():
+ soft_unlink(lockfile)
+ open(lockfile, "w").write("obviouslyboguspid")
+ with LockDirectory(lockfile):
+ pass
+
+def test_break_stale_lock():
+ soft_unlink(lockfile)
+ with LockDirectory(lockfile):
+ with LockDirectory(lockfile, expiry = 0):
+ pass
+
+def test_disk_usage():
+ assert disk_usage(tests.getTestFile("disk_usage_test"), "ignore_me") == 7