Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Merge branch v0.3 into master. Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 1fcdcff
Author: Alexey Popravka <[email protected]>
Date:   Wed Oct 25 11:41:24 2017 +0300

    Bump version: 0.3.3 → 0.3.4

commit 56e7c34
Author: Alexey Popravka <[email protected]>
Date:   Wed Oct 25 11:36:25 2017 +0300

    update changes.txt

commit 4171376
Author: Alexey Popravka <[email protected]>
Date:   Wed Oct 25 11:26:06 2017 +0300

    fix test

commit aaae7b8
Author: Alexey Popravka <[email protected]>
Date:   Wed Oct 25 11:14:42 2017 +0300

    add integrational test to compare v0.x version with v1.x

commit 2a6cf14
Author: Alexey Popravka <[email protected]>
Date:   Wed Oct 25 10:39:23 2017 +0300

    fix time command when connection-wide encoding is set (fixes #266)

commit ac47208
Author: Alexey Popravka <[email protected]>
Date:   Fri Jun 30 10:54:12 2017 +0300

    spelling

commit 7a26c16
Author: Alexey Popravka <[email protected]>
Date:   Fri Jun 30 10:25:33 2017 +0300

    bump version to v0.3.3

commit 1082256
Merge: 71ea399 718f731
Author: Alexey Popravka <[email protected]>
Date:   Fri Jun 30 10:19:20 2017 +0300

    Merge pull request #257 from pfreixes/fix_lock_critical_bug_v03

    Fix critical bug with patched Lock

commit 718f731
Author: Pau Freixes <[email protected]>
Date:   Thu Jun 29 22:44:53 2017 +0200

    Fix critical bug with patched Lock

commit 71ea399
Author: Alexey Popravka <[email protected]>
Date:   Wed Jun 21 10:56:12 2017 +0300

    fix typo

commit 98ee8be
Author: Alexey Popravka <[email protected]>
Date:   Wed Jun 21 10:47:36 2017 +0300

    Bump version: 0.3.1 → 0.3.2

commit 013ec54
Author: Alexey Popravka <[email protected]>
Date:   Wed Jun 21 10:47:22 2017 +0300

    update CHANGES

commit b2cfb7b
Author: Alexey Popravka <[email protected]>
Date:   Wed Jun 21 10:28:19 2017 +0300

    fix timeout passing in pool

commit 201451d
Author: Pau Freixes <[email protected]>
Date:   Wed Jun 21 08:46:50 2017 +0200

    * #231 Patch for the cpython issue with Lock

    * Make Lock compatible with 3.3 and 3.4

    * Changed test to make it compatible with python 3.3 version

    * Flake8 issue

    * Increase coverage by reducing scope, test just the bugfix for 3.6

    * One unique version of Lock.acquire function

    * Use create_future provided by aioredis

commit 2ca2f08
Author: argaen <[email protected]>
Date:   Thu Jun 8 20:40:44 2017 +0200

    Create only one task for closing

commit e7a0063
Author: argaen <[email protected]>
Date:   Mon Jun 5 16:26:22 2017 +0200

    close_waiter is lazily created

commit e38be72
Author: Pau Freixes <[email protected]>
Date:   Thu May 11 22:07:33 2017 +0200

    Removed print

commit f77a06b
Author: Pau Freixes <[email protected]>
Date:   Thu May 11 17:07:55 2017 +0200

    Some small MR issues fixed

commit eaede3d
Author: Pau Freixes <[email protected]>
Date:   Wed May 10 16:40:24 2017 +0200

    Support for connection timeout param

    Related to #184, it allows aioredis to configure a limited
    time that will be used trying to open a connection, if it is
    reached a `asyncio.TimeoutError` will be raised

    By default any timeout is configured.

commit 6b13dd1
Author: Alexey Popravka <[email protected]>
Date:   Mon Mar 6 10:36:37 2017 +0200

    tiny styling fix

commit 864a390
Author: marijngiesen <[email protected]>
Date:   Fri Mar 3 10:25:20 2017 +0100

    Fixed flake8 errors

commit b36a17a
Author: marijngiesen <[email protected]>
Date:   Fri Mar 3 01:38:42 2017 +0100

    Fixed typo

commit d93e25d
Author: marijngiesen <[email protected]>
Date:   Fri Mar 3 01:36:37 2017 +0100

    Added ZREVRANGEBYLEX command

commit bab6a0b
Author: Alexey Popravka <[email protected]>
Date:   Tue May 9 22:15:29 2017 +0300

    update spelling wordlist

commit e2bae24
Author: Alexey Popravka <[email protected]>
Date:   Tue May 9 22:11:40 2017 +0300

    Bump version: 0.3.0 → 0.3.1

commit 1c4327c
Author: Alexey Popravka <[email protected]>
Date:   Tue May 9 22:11:35 2017 +0300

    update changes

commit 3b779a8
Author: Alexey Popravka <[email protected]>
Date:   Mon Mar 27 10:42:04 2017 +0300

    fix pubsub Receiver missing iter() method (fixes #203)
  • Loading branch information
popravich committed Oct 31, 2017
1 parent 24eca32 commit 4d5d996
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 3 deletions.
18 changes: 18 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ Changes
* Update dependencies versions;


0.3.4 (2017-10-25)
^^^^^^^^^^^^^^^^^^

**FIX**:

* Fix time command result decoding when using connection-wide encoding setting
(see `#266 <https://github.com/aio-libs/aioredis/pull/266>`_);


0.3.3 (2017-06-30)
^^^^^^^^^^^^^^^^^^

**FIX**:

* Critical bug fixed in patched asyncio.Lock
(see `#256 <https://github.com/aio-libs/aioredis/pull/256>`_);


0.3.2 (2017-06-21)
^^^^^^^^^^^^^^^^^^

Expand Down
3 changes: 0 additions & 3 deletions docs/api_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ The library provides connections pool. The basic usage is as follows:
.. versionadded:: v1.0
``parser``, ``pool_cls`` and ``connection_cls`` arguments added.

.. versionchanged:: v1.0
``commands_factory`` argument dropped.

:param address: An address where to connect. Can be a (host, port) tuple or
unix domain socket path string.
:type address: tuple or str
Expand Down
105 changes: 105 additions & 0 deletions tests/integrational_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import asyncio
import pytest

import aioredis
from aioredis.util import async_task


@pytest.fixture
def pool_or_redis(_closable, server, loop):
version = tuple(map(int, aioredis.__version__.split('.')[:2]))
if version >= (1, 0):
factory = aioredis.create_redis_pool
else:
factory = aioredis.create_pool

@asyncio.coroutine
def redis_factory(maxsize):
redis = yield from factory(server.tcp_address, loop=loop,
minsize=1, maxsize=maxsize)
_closable(redis)
return redis
return redis_factory


@asyncio.coroutine
def simple_get_set(pool, idx, loop):
"""A simple test to make sure Redis(pool) can be used as old Pool(Redis).
"""
val = 'val:{}'.format(idx)
with (yield from pool) as redis:
assert (yield from redis.set('key', val))
yield from redis.get('key', encoding='utf-8')


@asyncio.coroutine
def pipeline(pool, val, loop):
val = 'val:{}'.format(val)
with (yield from pool) as redis:
f1 = redis.set('key', val)
f2 = redis.get('key', encoding='utf-8')
ok, res = yield from asyncio.gather(f1, f2, loop=loop)


@asyncio.coroutine
def transaction(pool, val, loop):
val = 'val:{}'.format(val)
with (yield from pool) as redis:
tr = redis.multi_exec()
tr.set('key', val)
tr.get('key', encoding='utf-8')
ok, res = yield from tr.execute()
assert ok, ok
assert res == val


@asyncio.coroutine
def blocking_pop(pool, val, loop):

@asyncio.coroutine
def lpush():
with (yield from pool) as redis:
# here v0.3 has bound connection, v1.0 does not;
yield from asyncio.sleep(.1, loop=loop)
yield from redis.lpush('list-key', 'val')

@asyncio.coroutine
def blpop():
with (yield from pool) as redis:
# here v0.3 has bound connection, v1.0 does not;
res = yield from redis.blpop(
'list-key', timeout=1, encoding='utf-8')
assert res == ['list-key', 'val'], res
yield from asyncio.gather(blpop(), lpush(), loop=loop)


@pytest.mark.run_loop
@pytest.mark.parametrize('test_case,pool_size', [
(simple_get_set, 1),
(pipeline, 1),
(transaction, 1),
pytest.mark.xfail((blocking_pop, 1),
reason="blpop gets connection first and blocks"),
(simple_get_set, 10),
(pipeline, 10),
(transaction, 10),
(blocking_pop, 10),
], ids=lambda o: o.__name__)
def test_operations(pool_or_redis, test_case, pool_size, loop):
repeat = 100
redis = yield from pool_or_redis(pool_size)
done, pending = yield from asyncio.wait(
[async_task(test_case(redis, i, loop), loop=loop)
for i in range(repeat)], loop=loop)

assert not pending
success = 0
failures = []
for fut in done:
exc = fut.exception()
if exc is None:
success += 1
else:
failures.append(exc)
assert repeat == success, failures
assert not failures

0 comments on commit 4d5d996

Please sign in to comment.