Exemplo n.º 1
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)
Exemplo n.º 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)
Exemplo n.º 3
0
def try_file_lock(path):
    fd = lock_file(path, timeout=2)
    sys.exit(0 if fd else 1)
Exemplo n.º 4
0
def try_file_lock(path):
    fd = lock_file(path, timeout=2)
    sys.exit(0 if fd else 1)