Commits

Lynn Rees committed e6575b6

- update

  • Participants
  • Parent commits 7930cdb

Comments (0)

Files changed (5)

     firebird=shove.caches.db:DBCache
     memcache=shove.caches.memcached:MemCache
     memlru=shove.cache:MemoryLRUCache
-    memory=shove.caches:MemoryCache
+    memory=shove.cache:MemoryCache
     mssql=shove.caches.db:DBCache
     mysql=shove.caches.db:DBCache
     oracle=shove.caches.db:DBCache

File shove/__init__.py

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

File shove/_compat.py

 # -*- coding: utf-8 -*-
 '''shove compatibility shim for different python versions.'''
 
-try:
-    import anydbm
-except ImportError:
-    import dbm as anydbm
-try:
-    from urllib import url2pathname
-except ImportError:
-    from urllib.request import url2pathname
-try:
-    from urlparse import urlsplit
-    from urllib import quote_plus, unquote_plus
-except ImportError:
-    from urllib.parse import urlsplit, quote_plus, unquote_plus
+from stuf.six import PY3
+from stuf.base import backport
 
-from stuf.six import PY3
-from stuf.six.moves import StringIO  # @UnresolvedImport
+anydbm = backport('anydbm', 'dbm')
+url2pathname = backport('urllib.url2pathname', 'urllib.request.url2pathname')
+urlsplit = backport('urlparse.urlsplit', 'urllib.parse.urlsplit')
+quote_plus = backport('urllib.quote_plus', 'urllib.parse.quote_plus')
+unquote_plus = backport('urllib.unquote_plus', 'urllib.parse.unquote_plus')
+StringIO = backport('stuf.six.moves.StringIO')
 
 
 def synchronized(func):

File tests/test_cache.py

 '''shove cache tests'''
 
 from stuf.six import PY3, unittest
+
 from tests.mixins import Spawn
 
+
 setUpModule = Spawn.setUpModule
 tearDownModule = Spawn.tearDownModule
 
 class NoTimeout(object):
 
     def setUp(self):
-        self.cache = self._makeone(self.initstring)
+        from shove._imports import cache_backend
+        self.cache = cache_backend(self.initstring)
 
     def tearDown(self):
         self.cache = None
 
     def test_timeout(self):
         import time
-        cache = self._makeone(self.initstring, timeout=1)
+        from shove._imports import cache_backend
+        cache = cache_backend(self.initstring, timeout=1)
         cache['test'] = 'test'
         time.sleep(3)
         def tmp(): #@IgnorePep8
 class CacheCull(Cache):
 
     def test_cull(self):
-        cache = self._makeone(self.initstring, max_entries=1)
+        from shove._imports import cache_backend
+        cache = cache_backend(self.initstring, max_entries=1)
         cache['test'] = 'test'
         cache['test2'] = 'test'
         cache['test2'] = 'test'
 
     initstring = 'simple://'
 
-    @property
-    def _makeone(self):
-        from shove.cache import SimpleCache
-        return SimpleCache
-
 
 class TestSimpleLRUCache(NoTimeout, unittest.TestCase):
 
     initstring = 'simplelru://'
 
-    @property
-    def _makeone(self):
-        from shove.cache import SimpleLRUCache
-        return SimpleLRUCache
-
 
 class TestMemoryCache(CacheCull, unittest.TestCase):
 
     initstring = 'memory://'
 
-    @property
-    def _makeone(self):
-        from shove.cache import MemoryCache
-        return MemoryCache
-
 
 class TestMemoryLRUCache(NoTimeout, unittest.TestCase):
 
     initstring = 'memlru://'
 
-    @property
-    def _makeone(self):
-        from shove.cache import MemoryLRUCache
-        return MemoryLRUCache
-
 
 class TestFileCache(CacheCull, unittest.TestCase):
 
     initstring = 'file://test'
 
-    @property
-    def _makeone(self):
-        from shove.cache import FileCache
-        return FileCache
-
     def tearDown(self):
         import shutil
         self.cache = None
 
     initstring = 'filelru://test2'
 
-    @property
-    def _makeone(self):
-        from shove.cache import FileLRUCache
-        return FileLRUCache
-
     def tearDown(self):
         import shutil
         self.cache = None
 
     initstring = 'sqlite:///'
 
-    @property
-    def _makeone(self):
-        from shove.caches.db import DBCache
-        return DBCache
-
 
 if not PY3:
     class TestMemcache(Cache, Spawn, unittest.TestCase):
         initstring = 'memcache://localhost:11211'
         cmd = ['memcached']
 
-        @property
-        def _makeone(self):
-            from shove.caches.memcached import MemCache
-            return MemCache
-
     class TestRedisCache(Cache, Spawn, unittest.TestCase):
 
         initstring = 'redis://localhost:6379/0'
         cmd = ['redis-server']
 
-        @property
-        def _makeone(self):
-            from shove.caches.redisdb import RedisCache
-            return RedisCache
-
 
 if __name__ == '__main__':
     unittest.main()

File tests/test_multishove.py

 
     def setUp(self):
         from shove.core import ThreadShove
-        self.store = ThreadShove(*self.stores, max_workers=2, sync=0)
+        self.store = ThreadShove(*self.stores, max_workers=3, sync=0)
 
     def tearDown(self):
         import shutil