summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Dewey <john@dewey.ws>2011-01-25 17:22:16 -0800
committerJohn Dewey <john@dewey.ws>2011-01-25 17:22:16 -0800
commit5ef600a9b8ad8401bf4d1f4b4f4c771b88a2acc0 (patch)
tree83c2e39cd24a2df47eec367122cee7dd773dc64d
parentb1d2fc75d57080b3e0867f93aae71d0613d72d3c (diff)
Removal of image tempdir in test tearDown. Also, reformatted a couple
method comments to match the file's style.
-rw-r--r--nova/image/local.py12
-rw-r--r--nova/tests/api/openstack/test_images.py1
2 files changed, 11 insertions, 2 deletions
diff --git a/nova/image/local.py b/nova/image/local.py
index 908d72d1d..c4b7b9ad5 100644
--- a/nova/image/local.py
+++ b/nova/image/local.py
@@ -62,7 +62,9 @@ class LocalImageService(service.BaseImageService):
return id
def update(self, context, image_id, data):
- """Replace the contents of the given image with the new data."""
+ """
+ Replace the contents of the given image with the new data.
+ """
try:
pickle.dump(data, open(self._path_to(image_id), 'w'))
except IOError:
@@ -79,7 +81,13 @@ class LocalImageService(service.BaseImageService):
def delete_all(self):
"""
- Clears out all images in local directory
+ Clears out all images in local directory.
"""
for id in self._ids():
os.unlink(self._path_to(id))
+
+ def delete_imagedir(self):
+ """
+ Deletes the local directory. Raises OSError if directory is not empty.
+ """
+ os.rmdir(self._path)
diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py
index 5d9ddefbe..8ab4d7569 100644
--- a/nova/tests/api/openstack/test_images.py
+++ b/nova/tests/api/openstack/test_images.py
@@ -143,6 +143,7 @@ class LocalImageServiceTest(unittest.TestCase,
def tearDown(self):
self.service.delete_all()
+ self.service.delete_imagedir()
self.stubs.UnsetAll()