MCPcopy Create free account
hub / github.com/tox-dev/filelock / test_lock_mode_soft

Function test_lock_mode_soft

tests/test_filelock.py:591–610  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

589
590
591def test_lock_mode_soft(tmp_path: Path) -> None:
592 # test soft lock permissions are dependent of umask
593 lock_path = tmp_path / "a.lock"
594 lock = SoftFileLock(str(lock_path), mode=0o666)
595
596 # set umask so permissions can be anticipated
597 initial_umask = os.umask(0o022)
598 try:
599 lock.acquire()
600 assert lock.is_locked
601
602 mode = filemode(lock_path.stat().st_mode)
603 if sys.platform == "win32":
604 assert mode == "-rw-rw-rw-"
605 else:
606 assert mode == "-rw-r--r--"
607 finally:
608 os.umask(initial_umask)
609
610 lock.release()
611
612
613def test_umask(tmp_path: Path) -> None:

Callers

nothing calls this directly

Calls 3

SoftFileLockClass · 0.90
acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…