summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2011-12-12 14:16:00 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2011-12-12 14:16:00 +0000
commitd655eb0e7f6d454df9e2669143035db7fa6f38d4 (patch)
treea290b21319ed059e2a45eca0550128cfa32d3ca9 /morphlib
parent478a0997c147ee717f7c731d6fc1224b5be8b8f8 (diff)
downloadmorph-d655eb0e7f6d454df9e2669143035db7fa6f38d4.tar.gz
Fix Cachedir to convert relative paths to absolute paths
This also required a test to be changed as it assumed that the path it created the Cachedir with was the same one it stored. It also technically makes the new test redundant as testing if dirname is equal to an absolute path also tests if it retrieves values by absolute path.
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/cachedir.py2
-rw-r--r--morphlib/cachedir_tests.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/morphlib/cachedir.py b/morphlib/cachedir.py
index e5f5f419..803c4359 100644
--- a/morphlib/cachedir.py
+++ b/morphlib/cachedir.py
@@ -23,7 +23,7 @@ class CacheDir(object):
'''Manage Baserock cached binaries.'''
def __init__(self, dirname):
- self.dirname = dirname
+ self.dirname = os.path.abspath(dirname)
def key(self, dict_key):
'''Create a string key from a dictionary key.
diff --git a/morphlib/cachedir_tests.py b/morphlib/cachedir_tests.py
index ef1fa2de..dec6358a 100644
--- a/morphlib/cachedir_tests.py
+++ b/morphlib/cachedir_tests.py
@@ -27,7 +27,7 @@ class CacheDirTests(unittest.TestCase):
self.cachedir = morphlib.cachedir.CacheDir(self.dirname)
def test_sets_dirname_attribute(self):
- self.assertEqual(self.cachedir.dirname, self.dirname)
+ self.assertEqual(self.cachedir.dirname, os.path.abspath(self.dirname))
def test_uses_absolute_path(self):
abspath = os.path.abspath(self.dirname)