Пример #1
0
 def testLockingTwoFiles(self):
     self.lock.acquire()
     tmpfile2 = tempfile.NamedTemporaryFile()
     lock2 = lockfile.FileLock(tmpfile2.name)
     lock2.acquire()
     self.failUnless(self.lock.is_locked())
     self.failUnless(lock2.is_locked())
Пример #2
0
 def __createLockFile(self, filename):
     if operating_system.isWindows() and self.__isCloud(filename):
         return DummyLockFile()
     if self.__isFuse(filename):
         return lockfile.MkdirFileLock(filename)
     return lockfile.FileLock(filename)
Пример #3
0
 def setUp(self):
     self.tmpfile = tempfile.NamedTemporaryFile()
     self.lock = lockfile.FileLock(self.tmpfile.name)
Пример #4
0
 def break_lock(self, filename):
     self.__lock = lockfile.FileLock(filename)
     self.__lock.break_lock()
Пример #5
0
 def acquire_lock(self, filename):
     if not self.is_locked_by_me():
         self.__lock = lockfile.FileLock(filename)
         self.__lock.acquire(-1)  # Fail immediately if we can't get a lock
Пример #6
0
 def acquire_lock(self, filename):
     if not self.is_locked_by_me():
         self.__lock = lockfile.FileLock(filename)
         self.__lock.acquire(5)