diff options
author | Vincent Driessen <vincent@3rdcloud.com> | 2013-02-06 22:36:23 +0100 |
---|---|---|
committer | Vincent Driessen <vincent@3rdcloud.com> | 2013-02-06 22:54:20 +0100 |
commit | 54254f227112f6cd32cc47ee1a2494ef9923a10e (patch) | |
tree | fdfd9f3b80d0e759343ab52eeeb983840ae0a608 /tests/__init__.py | |
parent | 67880343f1e3e8a0127db445ea07afba4e1a97b9 (diff) | |
download | rq-54254f227112f6cd32cc47ee1a2494ef9923a10e.tar.gz |
Patch the connection instances.
This patches the connection object (which is either a StrictRedis
instance or a Redis instance), to have alternative class methods that
behave exactly like their StrictRedis counterparts, no matter whether
which type the object is. Only the ambiguous methods are patched. The
exhaustive list:
- _zadd (fixes argument order)
- _lrem (fixes argument order)
- _setex (fixes argument order)
- _pipeline (always returns a StrictPipeline)
- _ttl (fixes return value)
- _pttl (fixes return value)
This makes it possible to call the methods reliably without polluting
the RQ code any further.
Diffstat (limited to 'tests/__init__.py')
-rw-r--r-- | tests/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index cba1035..688c11f 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -5,7 +5,7 @@ if is_python_version((2, 7), (3, 2)): else: import unittest2 as unittest # noqa -from redis import Redis +from redis import StrictRedis from rq import push_connection, pop_connection @@ -14,7 +14,7 @@ def find_empty_redis_database(): will use/connect it when no keys are in there. """ for dbnum in range(4, 17): - testconn = Redis(db=dbnum) + testconn = StrictRedis(db=dbnum) empty = len(testconn.keys('*')) == 0 if empty: return testconn |