From 98fe2b504bfcebb57fee621346a37e1f48fbacaa Mon Sep 17 00:00:00 2001 From: Hengqing Hu Date: Fri, 2 Mar 2012 22:32:05 +0800 Subject: Set lock_path to a tempdir in TestLockCleanup Fixes bug #945363 Change-Id: I2e2b81eebbfce0c10e431041f6b9d45bcf26f1c0 --- nova/tests/test_utils.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'nova') diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py index 15b618d8e..a220bf336 100644 --- a/nova/tests/test_utils.py +++ b/nova/tests/test_utils.py @@ -20,6 +20,7 @@ import hashlib import os import os.path import socket +import shutil import StringIO import tempfile @@ -828,6 +829,8 @@ class TestLockCleanup(test.TestCase): self.pid = os.getpid() self.dead_pid = self._get_dead_pid() + self.tempdir = tempfile.mkdtemp() + self.flags(lock_path=self.tempdir) self.lock_name = 'nova-testlock' self.lock_file = os.path.join(FLAGS.lock_path, self.lock_name + '.lock') @@ -839,6 +842,10 @@ class TestLockCleanup(test.TestCase): if errno == 2: pass + def tearDown(self): + shutil.rmtree(self.tempdir) + super(TestLockCleanup, self).tearDown() + def _get_dead_pid(self): """get a pid for a process that does not exist""" -- cgit