Skip to content

Commit d116aa6

Browse files
authored
Merge pull request #22 from valkey-io/aiven-sal/changes_for_b7
Version 5.1.0b7
2 parents a1053d7 + cffd4f0 commit d116aa6

14 files changed

+530
-185
lines changed

.github/workflows/integration.yaml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ jobs:
113113
python-version: ['3.8', '3.11']
114114
test-type: ['standalone', 'cluster']
115115
connection-type: ['hiredis', 'plain']
116-
protocol: ['3']
116+
exclude:
117+
- test-type: 'cluster'
118+
connection-type: 'hiredis'
117119
env:
118120
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
119121
name: RESP3 [${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}]
@@ -132,9 +134,33 @@ jobs:
132134
pip install hiredis
133135
fi
134136
invoke devenv
135-
sleep 5 # time to settle
136-
invoke ${{matrix.test-type}}-tests
137-
invoke ${{matrix.test-type}}-tests --uvloop
137+
sleep 10 # time to settle
138+
invoke ${{matrix.test-type}}-tests --protocol=3
139+
invoke ${{matrix.test-type}}-tests --uvloop --protocol=3
140+
141+
- uses: actions/upload-artifact@v4
142+
if: success() || failure()
143+
with:
144+
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}-resp3
145+
path: '${{matrix.test-type}}*results.xml'
146+
147+
- name: Upload codecov coverage
148+
uses: codecov/codecov-action@v4
149+
with:
150+
fail_ci_if_error: false
151+
152+
- name: View Test Results
153+
uses: dorny/test-reporter@v1
154+
if: success() || failure()
155+
continue-on-error: true
156+
with:
157+
name: Test Results ${{matrix.python-version}} ${{matrix.test-type}}-${{matrix.connection-type}}-resp3
158+
path: '*.xml'
159+
reporter: java-junit
160+
list-suites: all
161+
list-tests: all
162+
max-annotations: 10
163+
fail-on-error: 'false'
138164

139165
build_and_test_package:
140166
name: Validate building and installing the package

dev_requirements.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
click==8.0.4
21
black==24.3.0
32
cachetools
4-
flake8==5.0.4
3+
click==8.0.4
54
flake8-isort==6.0.0
5+
flake8==5.0.4
66
flynt~=0.69.0
7+
invoke==1.7.3
78
mock==4.0.3
89
packaging>=20.4
9-
pytest==7.2.0
10-
pytest-timeout==2.1.0
11-
pytest-asyncio>=0.20.2
12-
invoke==1.7.3
13-
pytest-cov>=4.0.0
14-
vulture>=2.3.0
10+
pytest
11+
pytest-asyncio
12+
pytest-cov
13+
pytest-timeout
1514
ujson>=4.2.0
16-
wheel>=0.30.0
1715
urllib3<2
1816
uvloop
17+
vulture>=2.3.0
18+
wheel>=0.30.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
long_description_content_type="text/markdown",
99
keywords=["Valkey", "key-value store", "database"],
1010
license="MIT",
11-
version="5.1.0b6",
11+
version="5.1.0b7",
1212
packages=find_packages(
1313
include=[
1414
"valkey",

tests/test_asyncio/conftest.py

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
import pytest_asyncio
66
import valkey.asyncio as valkey
77
from tests.conftest import VALKEY_INFO
8-
from valkey._parsers import _AsyncHiredisParser, _AsyncRESP2Parser
98
from valkey.asyncio import Sentinel
109
from valkey.asyncio.client import Monitor
1110
from valkey.asyncio.connection import Connection, parse_url
1211
from valkey.asyncio.retry import Retry
1312
from valkey.backoff import NoBackoff
14-
from valkey.utils import HIREDIS_AVAILABLE
1513

1614
from .compat import mock
1715

@@ -26,41 +24,21 @@ async def _get_info(valkey_url):
2624
@pytest_asyncio.fixture(
2725
params=[
2826
pytest.param(
29-
(True, _AsyncRESP2Parser),
27+
(True,),
3028
marks=pytest.mark.skipif(
3129
'config.VALKEY_INFO["cluster_enabled"]', reason="cluster mode enabled"
3230
),
3331
),
34-
(False, _AsyncRESP2Parser),
35-
pytest.param(
36-
(True, _AsyncHiredisParser),
37-
marks=[
38-
pytest.mark.skipif(
39-
'config.VALKEY_INFO["cluster_enabled"]',
40-
reason="cluster mode enabled",
41-
),
42-
pytest.mark.skipif(
43-
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
44-
),
45-
],
46-
),
47-
pytest.param(
48-
(False, _AsyncHiredisParser),
49-
marks=pytest.mark.skipif(
50-
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
51-
),
52-
),
32+
(False,),
5333
],
5434
ids=[
55-
"single-python-parser",
56-
"pool-python-parser",
57-
"single-hiredis",
58-
"pool-hiredis",
35+
"single",
36+
"pool",
5937
],
6038
)
6139
async def create_valkey(request):
6240
"""Wrapper around valkey.create_valkey."""
63-
single_connection, parser_cls = request.param
41+
(single_connection,) = request.param
6442

6543
teardown_clients = []
6644

@@ -76,10 +54,9 @@ async def client_factory(
7654
cluster_mode = VALKEY_INFO["cluster_enabled"]
7755
if not cluster_mode:
7856
single = kwargs.pop("single_connection_client", False) or single_connection
79-
parser_class = kwargs.pop("parser_class", None) or parser_cls
8057
url_options = parse_url(url)
8158
url_options.update(kwargs)
82-
pool = valkey.ConnectionPool(parser_class=parser_class, **url_options)
59+
pool = valkey.ConnectionPool(**url_options)
8360
client = cls(connection_pool=pool)
8461
else:
8562
client = valkey.ValkeyCluster.from_url(url, **kwargs)

tests/test_asyncio/test_commands.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,6 +2919,31 @@ async def test_xinfo_stream(self, r: valkey.Valkey):
29192919
assert info["first-entry"] == await get_stream_message(r, stream, m1)
29202920
assert info["last-entry"] == await get_stream_message(r, stream, m2)
29212921

2922+
await r.xtrim(stream, 0)
2923+
info = await r.xinfo_stream(stream)
2924+
assert info["length"] == 0
2925+
assert info["first-entry"] is None
2926+
assert info["last-entry"] is None
2927+
2928+
@skip_if_server_version_lt("6.0.0")
2929+
async def test_xinfo_stream_full(self, r: valkey.Valkey):
2930+
stream = "stream"
2931+
group = "group"
2932+
2933+
await r.xadd(stream, {"foo": "bar"})
2934+
info = await r.xinfo_stream(stream, full=True)
2935+
assert info["length"] == 1
2936+
assert len(info["groups"]) == 0
2937+
2938+
await r.xgroup_create(stream, group, 0)
2939+
info = await r.xinfo_stream(stream, full=True)
2940+
assert info["length"] == 1
2941+
2942+
await r.xreadgroup(group, "consumer", streams={stream: ">"})
2943+
info = await r.xinfo_stream(stream, full=True)
2944+
consumer = info["groups"][0]["consumers"][0]
2945+
assert isinstance(consumer, dict)
2946+
29222947
@skip_if_server_version_lt("5.0.0")
29232948
async def test_xlen(self, r: valkey.Valkey):
29242949
stream = "stream"

0 commit comments

Comments
 (0)