コード例 #1
0
ファイル: test_filesystem.py プロジェクト: ccbrown/needy
 def test_lock_file_non_blocking(self):
     with TempDir() as d:
         path = os.path.join(d, 'tempfile')
         fd = lock_file(path, timeout=0)
         self.assertTrue(fd)
         self.assertFalse(self.try_access_from_other_process(path))
         os.close(fd)
コード例 #2
0
 def test_lock_file_non_blocking(self):
     with TempDir() as d:
         path = os.path.join(d, 'tempfile')
         fd = lock_file(path, timeout=0)
         self.assertTrue(fd)
         self.assertFalse(self.try_access_from_other_process(path))
         os.close(fd)
コード例 #3
0
ファイル: test_filesystem.py プロジェクト: ccbrown/needy
def try_file_lock(path):
    fd = lock_file(path, timeout=2)
    sys.exit(0 if fd else 1)
コード例 #4
0
def try_file_lock(path):
    fd = lock_file(path, timeout=2)
    sys.exit(0 if fd else 1)