예제 #1
0
    def test_acquire_lock(self):
        lock_file_path = self.temp_dir / 'test.lock'

        lock_file = LockFile(lock_file_path)
        lock_file.acquire_lock()

        self.assertTrue(lock_file.has_lock())
        self.assertTrue(lock_file.is_locked())

        self.assertTrue(lock_file_path.exists())
예제 #2
0
    def test_create_parent_dirs(self):
        lock_file_path = self.temp_dir / 'foo' / 'bar' / 'test.lock'

        lock_file = LockFile(lock_file_path)
        lock_file.acquire_lock()

        self.assertTrue(lock_file.has_lock())
        self.assertTrue(lock_file.is_locked())

        self.assertTrue(lock_file_path.exists())
        self.assertTrue(lock_file_path.parent.is_dir())
        self.assertTrue(lock_file_path.parent.parent.is_dir())