def test_lock_unlock(self): if os.path.exists(self.lock_file): os.remove(self.lock_file) b = DNSBuilder(STAGE_DIR=self.stage_dir, PROD_DIR=self.prod_dir, LOCK_FILE=self.lock_file) self.assertFalse(os.path.exists(self.lock_file)) b.lock() self.assertTrue(os.path.exists(self.lock_file)) for i in xrange(10): b.unlock() b.lock() b.unlock() self.assertTrue(os.path.exists(self.lock_file)) b.lock() self.assertTrue(os.path.exists(self.lock_file)) b.unlock() self.assertTrue(os.path.exists(self.lock_file))