locationlabs / mockredis Goto Github PK
View Code? Open in Web Editor NEWmock for redis-py (NO LONGER SUPPORTED)
License: Apache License 2.0
mock for redis-py (NO LONGER SUPPORTED)
License: Apache License 2.0
Hi,
As the title says: slaveof() method is throwing exception:
AttributeError: 'MockRedis' object has no attribute 'slaveof'
Thanks
If all elements from sorted set are removed and the set has cardinality of 0, its key is still listed in output of keys()
method and this differs from redis behaviour - redis doesn't returns these keys:
$ redis-cli
redis 127.0.0.1:6379> ZADD myzset 1 "one"
(integer) 1
redis 127.0.0.1:6379> ZADD myzset 2 "two"
(integer) 1
redis 127.0.0.1:6379> ZADD myzset 3 "three"
(integer) 1
redis 127.0.0.1:6379> ZCARD myzset
(integer) 3
redis 127.0.0.1:6379> ZREM myzset "one" "two" "three"
(integer) 3
redis 127.0.0.1:6379> ZCARD myzset
(integer) 0
redis 127.0.0.1:6379> KEYS *
(empty list or set)
redis 127.0.0.1:6379>
In [1]: from mockredis import mock_strict_redis_client
In [2]: redis = mock_strict_redis_client()
In [3]: redis.zadd('myzset', 1, 'one')
Out[3]: 1
In [4]: redis.zadd('myzset', 2, 'two')
Out[4]: 1
In [5]: redis.zadd('myzset', 3, 'three')
Out[5]: 1
In [6]: redis.zcard('myzset')
Out[6]: 3
In [7]: redis.zrem('myzset', 'one', 'two', 'three')
Out[7]: 3
In [8]: redis.zcard('myzset')
Out[8]: 0
In [9]: redis.keys('*')
Out[9]: ['myzset']
The names of the arguments to 'setex' are different. Mock-redis expects a 'key' argument where redis-py exects a 'name' argument. This means, if you call setex with keyword args it will not work both with tests and the actual module.
From mockredis (https://github.com/locationlabs/mockredis):
def setex(self, key, time, value):
"""
Set the value of ``key`` to ``value`` that expires in ``time``
seconds. ``time`` can be represented by an integer or a Python
timedelta object.
"""
if not self.strict:
# when not strict mode swap value and time args order
time, value = value, time
return self.set(key, value, ex=time)
From redis-py (https://github.com/andymccurdy/redis-py):
def setex(self, name, time, value):
"""
Set the value of key ``name`` to ``value`` that expires in ``time``
seconds. ``time`` can be represented by an integer or a Python
timedelta object.
"""
if isinstance(time, datetime.timedelta):
time = time.seconds + time.days * 24 * 3600
return self.execute_command('SETEX', name, time, value)
The title basically says it all, but my feature request is to add support for Redis Sentinel. I have something hacked together for the basic needs of my project, but it's by no means comprehensive like the rest of this is.
The library redisco uses the sort() method that is implemented in the python redis client [redisco: https://github.com/kiddouk/redisco/blob/master/redisco/models/modelset.py#L449 & https://github.com/kiddouk/redisco/blob/master/redisco/models/modelset.py#L425]
But the sort() method is not implemented in mockredis.
For reference python redis library sort() [https://github.com/andymccurdy/redis-py/blob/master/redis/client.py#L1086]
The problem occurs when i try to run the following code:
import redisco
from mockredis import MockRedis
redisco.connection = MockRedis()
for doc in Document.objects.all():
File "/home/grok/.virtualenvs/sod/local/lib/python2.7/site-packages/redisco/models/modelset.py", line 449, in _set_without_ordering
self.db.sort(old_set_key,
AttributeError: 'MockRedis' object has no attribute 'sort'
rpoplpush adds 'None' to the destination queue even if source queue is empty.
{code}
from redis import Redis
from mockredis import MockRedisred = Redis(port=6380)
mred = MockRedis()print red.lrange('aa', 0, -1)
[]
print red.lrange('bb', 0, -1)
[]
print red.rpoplpush('aa', 'bb')
None
print red.lrange('aa', 0, -1)
[]
print red.lrange('bb', 0, -1)
[]print mred.lrange('aa', 0, -1)
[]
print mred.lrange('bb', 0, -1)
[]
print mred.rpoplpush('aa', 'bb')
None
print mred.lrange('aa', 0, -1)
[]
print mred.lrange('bb', 0, -1)
['None']
{code}
Mockredis claims to be Python 3-compatible on the README, and perhaps it is for many uses cases, but it depends on a very old python-lunatic-bugfix
library that has not be updated in years and is not Python 3 compatible, so there's no way to use Mockredis with Lua and Python 3. Including mockredispy[lua]~=2.9
in my setup.py
results in this error:
Collecting lunatic-python-bugfix==1.1.1 (from mockredispy[lua]~=2.9->pysoa==0.18.1)
Using cached lunatic-python-bugfix-1.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/kf/1sq3029d6v3bvtg6066zxwyh0000gp/T/pip-build-nx1ghdoa/lunatic-python-bugfix/setup.py", line 5, in <module>
import commands
ModuleNotFoundError: No module named 'commands'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/kf/1sq3029d6v3bvtg6066zxwyh0000gp/T/pip-build-nx1ghdoa/lunatic-python-bugfix/
Need an update to a Python 3-compatible library. This author has forked the Lunatic project and kept it up-to-date, but doesn't seem interested in publishing to PyPi. He has opened a solicitation for transfer of ownership, and perhaps you would be willing to take ownership and publish it?
In the meantime, I am looking at forking it for the purposes of publishing once to PyPi, but I can't commit the time necessary to take ownership.
The signature of redis.Redis.from_url
is as follows:
def from_url(cls, url, db=None, **kwargs)
However, Mockredispy defines it as follows:
def mock_redis_client(**kwargs):
return MockRedis()
mock_redis_client.from_url = mock_redis_client
If redis.Redis.from_url
is called with the valid arguments redis.Redis.from_url(url, **kwargs)
, it results in an error from Mockredispy about too many arguments passed to mock_redis_client
.
In [1]: from mockredis import mock_strict_redis_client
In [2]: redis = mock_strict_redis_client()
In [3]: with redis.pipeline() as pipeline:
...: pipeline.watch("foo")
...: print redis.get("foo")
...:
{}
In [4]: print redis.redis
defaultdict(<type 'dict'>, {'foo': {}})
redis.pipeline(transaction=False)
Results in:
TypeError: pipeline() got an unexpected keyword argument 'transaction'
See:
It would be nice to see some examples of how it works in practice instead of just seeing the conditions of its use in the actual module
In client.py:zadd(), the member is converted to a string:
insert_count = lambda member, score: 1 if zset.insert(str(member), float(score)) else 0
but not also done in sortedset.py:zscore() and zrank(), so if you:
zadd(key, 12345, 1.0)
zscore(key, 12345)
it fails to find the member.
The EXPIREAT command does not appear to be supported.
In [1]: from mockredis import mock_strict_redis_client
In [2]: redis = mock_strict_redis_client()
In [3]: print redis.lindex("mylist", 0)
None
In [4]: print redis.redis
defaultdict(<type 'dict'>, {'mylist': []})
In [5]: print redis.exists("mylist")
True
The mockredis.script:Script._import_lua_dependencies()
function is fragile because of the version of LUA it depends on. Short of fixing that, it should be possible to disable this loading code, if for example, use of cjson is not needed.
Per the documentation upstream: http://redis.io/commands/lrem
Currently lrem returns nothing.
In MockRedis, all values are strings:
>>> from redis import Redis
>>> import pickle
>>> r = Redis()
>>> r.set('foo', 1)
True
>>> r.get('foo')
b'1'
>>> r.set('bar', b'bar')
True
>>> r.get('bar')
b'bar'
>>> r.set('foo', pickle.dumps({'foo': 'bar'}))
True
>>> pickle.loads(r.get('foo'))
{'foo': 'bar'}
>>>
MockRedis
>>> from mockredis import MockRedis
>>> import pickle
>>> r = MockRedis()
>>> r.set('foo', 1)
True
>>> r.get('foo')
'1'
>>> r.set('bar', b'bar')
True
>>> r.get('bar')
"b'bar'"
>>> r.set('foo', pickle.dumps({'foo': 'bar'}))
True
>>> pickle.loads(r.get('foo'))
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
pickle.loads(r.get('foo'))
TypeError: 'str' does not support the buffer interface
>>>
ciao, i'm fiddling around a while now to run the unit tests of one of my projects with pytest
and mockredis
, but i'm failing with any attempt. my goal is to run all tests against the identical 'fake' redis client during the whole test session.
here's a condensed description:
tests/unit/conftest.py
:
import pytest
from mock import patch
from mockredis import mock_strict_redis_client
@pytest.fixture(scope='session', autouse=True)
def redis():
patch('redis.StrictRedis', mock_strict_redis_client)
from mockredis.client import MockRedis
from prototypes.caches.backend import StrictRedis
assert StrictRedis is MockRedis
(i know the conftest.py
is actually processd, as placing an assert 0
there breaks everything.)
tests/unit/test_bases.py
:
from prototypes.bases import NamespacedXMLDocument
from mockredis.client import MockRedis
from prototypes.caches.backend import StrictRedis
assert StrictRedis is MockRedis
def test_register_namespace():
class Foo(NamespacedXMLDocument):
class_namespaces = ('bar',)
Foo.register_xml_namespace('foo')
assert 'foo' in Foo.class_namespaces
the class NamespacedXMLDocument
has a cache property that is obtained from the get_client
function in prototypes.caches.backend.py
, which is the only place where StrictRedis
gets imported:
from redis import StrictRedis
from prototypes.caches import settings
def get_client(db: int = 0) -> StrictRedis:
kwargs = settings.REDIS_SETTINGS.copy()
kwargs.update({'db': db})
return StrictRedis(**kwargs)
yet, the tests do fail with a ConnectionRefusedError
thrown in redis/connection.py
.
though i'm quiet sure the issue doesn't lie within mockredis
as i also tried it with the heavier redislite
. interestingly a web search doesn't yield anything helpful. so either i'm really missing something obvious or i should amend the docs with an example for such a usecase. any hint is highly appreciated.
Right now, only the tar.gz
file is being distributed on PyPI for mockredispy, which isn't that much of an issue, but it does add some time to installing the package.
This package should be compatible with the Wheel format, considering it doesn't appear to have any C dependencies and it is compatible with both Python 2 and 3. As a result, you should only need to generate a universal wheel and then everyone (on all systems) will get the ability to install mockredispy with just the wheel, without having to do any extra work.
redis-py will not complain if aggregate arguments are capialized or not but mockredis does.
x.zunionstore('test2',['test1', 'test2'], aggregate='MIN') will not work for mockredis.
Since "mockredis" is already in use on pypi.python.org, we can't publish this project to make it more widely available.
Unless there is an objection, the next release will use the name "mockredispy" in setup.py. The package and project names will not change.
Here is a quick example in the ipython console of what the proper output should be:
In [1]: import redis
In [2]: r = redis.Redis()
In [6]: r.hmset('test', {1:1, 2:2, 3:3})
Out[6]: True
In [7]: r.hgetall('test')
Out[7]: {'1': '1', '2': '2', '3': '3'}
In [8]: from mockredis import mock_redis_client
In [9]: mr = mock_redis_client()
In [10]: mr.hmset('test', {1:1, 2:2, 3:3})
In [11]: mr.hgetall('test')
Out[11]: {1: '1', 2: '2', 3: '3'}
Setting decode_responses on the client should cause the client to return strings instead of bytes objects in python 3.
Python 3.5.0 (default, Oct 24 2015, 09:48:42)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mockredis import mock_strict_redis_client
>>>
>>> redis = mock_strict_redis_client(decode_responses=True)
>>> redis.set('yo', 'hello')
True
>>> redis.get('yo')
b'hello'
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from redis import StrictRedis
>>> r = StrictRedis('redis')
>>> r.set('yo', 'hello')
True
>>> r.get('yo')
b'hello'
>>> r = StrictRedis('redis', decode_responses=True)
>>> r.get('yo')
'hello'
The sample from http://seeknuance.com/2012/02/18/replacing-redis-with-a-python-mock/ shows a redis client that will always point to the same data source, where this mock will always point to a new data source.
Pushing data into a mocked up redis from within a test is important to testing using redis as a queue system.
The pubsub attribute in mockredis/client.py seems to be defined as a defaultdict that stores the lines passed by publish, whereas it should be a method that creates an object of PubSub(), that handles the subscription to the channel. We would still need that defaultdict under the cover and linked to the mocked PubSub instances that are handed out.
The nose plugin that mockredis defines isn't shipped with the distribution; this causes warnings:
/path/to/venv/local/lib/python2.7/site-packages/nose/plugins/manager.py:395: RuntimeWarning: Unable to load plugin with_redis = mockredis.tests.fixtures:WithRedis: No module named tests.fixtures
RuntimeWarning)
Example:
In [6]: from mockredis import MockRedis
In [7]: r = MockRedis(strict=True)
In [8]: r.zadd('trunc', 1.2345678912345, 'one')
Out[8]: 1
In [9]: r.zrange('trunc', 0, -1, withscores=True)
Out[9]: [('one', 1.23456789123)]
In [10]:
In [10]: from redis import StrictRedis
In [11]: r = StrictRedis()
In [12]: r.zadd('no-trunc', 1.2345678912345, 'one')
Out[12]: 1
In [13]: r.zrange('no-trunc', 0, -1, withscores=True)
Out[13]: [('one', 1.2345678912345)]
This is caused by the string cast in client.py:_range_func that was added in commit 3068923 to address compatibility with redis-py in chucking a ValueError for casting float scores to int.
I started looking into this but I'm not sure what the right solution is yet. Removing the str() cast fixes the truncation issue but reverts the ValueError fix.
The actual redis-py client returns an integer in sismember, so mockredis should, too.
The fix for issue #52 added code to translate LIMIT and WITHSCORES arguments to ZRANGEBYSCORE and ZREVRANGEBYSCORE, but it looks only for lowercase versions of the keywords.
Redis itself compares with strcasecmp
, so any combination of case works. Mockredis ought to do the same.
Hi,
I would expect to be able to set a string in redis mock as mock_redis_instance.set('a', 'my-string')
but I could not find the set method.
I could find though a method to add a member to a set, sadd. Am I missing something? How can I set a string in mock redis?
In [1]: import mockredis
In [2]: m = mockredis.MockRedis()
In [3]: m.sadd('a', 'b')
In [4]: m.get('a')
Out[4]: {'b'}
In [5]: m.s
m.sadd m.smembers m.srandmember m.srem
In [5]: m.set('a', 'my-string')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-304d6e4f92c0> in <module>()
----> 1 m.set('a', 'b')
AttributeError: 'MockRedis' object has no attribute 'set'
All Best & thanks in advance,
Francesc
I noticed that when instantiating mockredis a second time, we don't have access to the keys that are in the first instance. Is this the expected behaviour?
I have a test for this:
https://gist.github.com/gotche/6888746
The first assert passes, the second doesn't
Thanks!
Because redis-py's argumentation doesn't map directly to the redis-server wire format, it is not always safe to use mockredis directly.
For example, ZREVRANGEBYSCORE
expects the explicit "limit" token in the wire format, but the "num" keyword argument in redisy-py.
I want to mock a redis docker container I tried this:
@patch('redis.Redis', mockredis.mock_redis_client(url=redis_conf.get('host'), db=redis_conf.get('db'), port=redis_conf.get('port')).strict)
but seems not working.
We host our python dependencies in an internal repository, and this section in the setup.py:
setup_requires=[
'nose'
]
forces it to look at the pypi website, ignoring the --index-url provided.
Is it possible to just add it to the requires.txt and exclude it from setup.py?
Thank you for a superb library, it works beautifully.
SortedSet does not define an cmp/eq method so comparison in pipeline.py:execute() fails, e.g.:
self.redis.zadd("foo", "bar", 1.0)
with self.redis.pipeline() as pipeline:
pipeline.watch("foo")
eq_(1, pipeline.zcard("foo"))
pipeline.multi()
eq_(pipeline, pipeline.zadd("foo", "baz", 2.0))
eq_([1], pipeline.execute())
will trigger a WatchError.
Provide an example , thanks U
Hi.. I am a newbie.. I have installed PyCharm and Python 3.4. Interpreter was set and upgraded to pip to the latest version. Now I am unable to add any package from the repository. Am getting the below error.
" Collecting unittest2
Could not fetch URL https://pypi.python.org/simple/unittest2/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) - skipping
* Could not find a version that satisfies the requirement unittest2 (from versions: )
No matching distribution found for unittest2 "*
In requirements.txt: mockredispy==2.9.0.11
After switching to a virtualenv, I run pip install -r requirements.txt
$ pip install -r requirements.txt
Downloading/unpacking mockredis (from -r requirements.txt (line 1))
Could not find a version that satisfies the requirement mockredis (from -r requirements.txt (line 1)) (from versions: 0.1.1dev, 0.1.2dev, 0.1.3dev, 0.1dev)
Cleaning up...
No distributions matching the version for mockredis (from -r requirements.txt (line 1))
If I just run pip install mockredisplay==2.9.0.11
, then it works.
This behaviour should be valid for all the commands.
Just an example hset and hmset, the first one cast the value to string but the latter one
Is there any plan to fix this in short term? Do you need any help?
Thanks
It should convert keys to string.
travis-ci executions for test_expireat_calculates_time
fail intermittently, with:
Traceback (most recent call last):
File "/home/travis/virtualenv/pypy/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/travis/build/locationlabs/mockredis/mockredis/tests/test_redis.py", line 157, in test_expireat_calculates_time
ok_(result <= 30, "Expected {} to be less than 30".format(result))
AssertionError: Expected 31 to be less than 30
The code path here computes datetime.fromtimestamp(int(time()) + 30)
evalutes the difference between that time and datetime.now()
using get_total_seconds()
. Apparently there's either a math error a timing error here.
dbsize() method throws an exception of
AttributeError: 'MockRedis' object has no attribute 'dbsize'
Running redis-2.10.5/setup.py -q bdist_egg --dist-dir /var/tmp/portage/dev-python/mockredispy-2.9.3/temp/easy_install-lkx2kg/redis-2.10.5/egg-dist-tmp-V7_gEI
Traceback (most recent call last):
File "setup.py", line 29, in
'with_redis = mockredis.noseplugin:WithRedis'
File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib64/python2.7/site-packages/setuptools/command/test.py", line 139, in run
self.distribution.fetch_build_eggs(self.distribution.tests_require)
File "/usr/lib64/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib64/python2.7/site-packages/pkg_resources/init.py", line 836, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/lib64/python2.7/site-packages/pkg_resources/init.py", line 1081, in best_match
return self.obtain(req, installer)
File "/usr/lib64/python2.7/site-packages/pkg_resources/init.py", line 1093, in obtain
return installer(requirement)
File "/usr/lib64/python2.7/site-packages/setuptools/dist.py", line 380, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib64/python2.7/site-packages/setuptools/command/easy_install.py", line 638, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib64/python2.7/site-packages/setuptools/command/easy_install.py", line 668, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib64/python2.7/site-packages/setuptools/command/easy_install.py", line 851, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib64/python2.7/site-packages/setuptools/command/easy_install.py", line 1079, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib64/python2.7/site-packages/setuptools/command/easy_install.py", line 1065, in run_setup
run_setup(setup_script, args)
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 240, in run_setup
raise
File "/usr/lib64/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 193, in setup_context
yield
File "/usr/lib64/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 152, in save_modules
yield saved
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 126, in exit
self._saved = UnpickleableException.dump(type, exc)
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
File "/usr/lib64/python2.7/site-packages/setuptools/sandbox.py", line 110, in dump
return cls.dump(cls, cls(repr(exc)))
MemoryError
Using 2.9.3 on Gentoo
Cannot find what version is your master, and it does not match the one installed by pip (2.9.3).
Just spent a couple hours wondering why I couldn't access the redis configuration attribute and methods, searching through this repository code, only to find out my installed version does not contain them.
Are there plans to deploy the current master version to PyPI?
According to the official Redis LPUSH documentation:
Return value
Integer reply: the length of the list after the push operations.
When I use mockredis, the same function returns None.
In mockredis, adding number to set and find by integer value (via redis.sismember) fails, as follow.
>>> import mockredis
>>> redis = mockredis.mock_redis_client()
>>> redis.sadd('myset', 1)
1
>>> redis.smembers('myset')
set(['1'])
>>> redis.sismember('myset', 1)
0
Last sismember should return 1 instead of 0, as expected in normal redis client.
>>> import redis
>>> s = redis.Redis(db=15)
>>> s.sadd('myset', 1)
1
>>> s.smembers('myset')
set(['1'])
>>> s.sismember('myset', 1)
True
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.