Commits

Lynn Rees  committed 3202def

- fix cassandra issue

  • Participants
  • Parent commits 45ff5d7

Comments (0)

Files changed (5)

     '''
     for line in open(fname):
         if line.startswith('__version__'):
-            return '%s.%s.%s' % eval(line[13:])
+            return '%s.%s.%s' % eval(line[13:].rstrip())
 
 
 def _promptup():
-    prompt('Enter tag: ', 'tag')
     with settings(warn_only=True):
-        local('hg tag "%(tag)s"' % getversion('shove/__init__.py'))
+        local('hg tag "%s"' % getversion('shove/__init__.py'))
         local('hg push ssh://hg@bitbucket.org/lcrees/shove')
         local('hg push github')
 
 
 def getversion(fname):
     '''Get the __version__ without importing.'''
-    for line in open(fname):
-        if line.startswith('__version__'):
-            return '%s.%s.%s' % eval(line[13:])
+    with open(fname) as f:
+        for line in f:
+            if line.startswith('__version__'):
+                return '%s.%s.%s' % eval(line[13:].rstrip())
 
 setup(
     name='shove',

File shove/__init__.py

 
 from shove.core import Shove
 
-__version__ = (0, 5, 1)
+__version__ = (0, 5, 2)
 
 __all__ = ['Shove']

File shove/stores/cassandra.py

 
     def __getitem__(self, key):
         try:
-            item = self._store.get(key).get(key)
+            item = self._store.get(key).get('key')
             if item is not None:
                 return self.loads(item)
             raise KeyError(key)

File shove/tests/test_store.py

 tearDownModule = Spawn.tearDownModule
 
 
-class EventualStore(object):
+class Store(object):
 
     def setUp(self):
         from shove import Shove
         self.store.sync()
         self.assertEqual(self.store['min'], 6)
 
-
-class Store(EventualStore):
-
     def test_clear(self):
         self.store['max'] = 3
         self.store['min'] = 6
             self.store.close()
             os.remove('test.db')
 
-    class TestCassandraStore(EventualStore, Spawn, unittest.TestCase):
+    class TestCassandraStore(Store, Spawn, unittest.TestCase):
 
         cmd = ['cassandra', '-f']
 
             self.store = Shove('cassandra://localhost:9160/Murk/shove')
 
         def tearDown(self):
-            self.store.clear()
-            self.store.close()
+            if self.store._store is not None:
+                self.store.clear()
+                self.store.close()
             from pycassa.system_manager import SystemManager  # @UnresolvedImport @IgnorePep8
             system_manager = SystemManager('localhost:9160')
             system_manager.drop_column_family('Murk', 'shove')