Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 5.1.0b7 #22

Merged
merged 5 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ jobs:
python-version: ['3.8', '3.11']
test-type: ['standalone', 'cluster']
connection-type: ['hiredis', 'plain']
protocol: ['3']
exclude:
- test-type: 'cluster'
connection-type: 'hiredis'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
name: RESP3 [${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}]
Expand All @@ -132,9 +134,33 @@ jobs:
pip install hiredis
fi
invoke devenv
sleep 5 # time to settle
invoke ${{matrix.test-type}}-tests
invoke ${{matrix.test-type}}-tests --uvloop
sleep 10 # time to settle
invoke ${{matrix.test-type}}-tests --protocol=3
invoke ${{matrix.test-type}}-tests --uvloop --protocol=3

- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}-resp3
path: '${{matrix.test-type}}*results.xml'

- name: Upload codecov coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false

- name: View Test Results
uses: dorny/test-reporter@v1
if: success() || failure()
continue-on-error: true
with:
name: Test Results ${{matrix.python-version}} ${{matrix.test-type}}-${{matrix.connection-type}}-resp3
path: '*.xml'
reporter: java-junit
list-suites: all
list-tests: all
max-annotations: 10
fail-on-error: 'false'

build_and_test_package:
name: Validate building and installing the package
Expand Down
18 changes: 9 additions & 9 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
click==8.0.4
black==24.3.0
cachetools
flake8==5.0.4
click==8.0.4
flake8-isort==6.0.0
flake8==5.0.4
flynt~=0.69.0
invoke==1.7.3
mock==4.0.3
packaging>=20.4
pytest==7.2.0
pytest-timeout==2.1.0
pytest-asyncio>=0.20.2
invoke==1.7.3
pytest-cov>=4.0.0
vulture>=2.3.0
pytest
pytest-asyncio
pytest-cov
pytest-timeout
ujson>=4.2.0
wheel>=0.30.0
urllib3<2
uvloop
vulture>=2.3.0
wheel>=0.30.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
long_description_content_type="text/markdown",
keywords=["Valkey", "key-value store", "database"],
license="MIT",
version="5.1.0b6",
version="5.1.0b7",
packages=find_packages(
include=[
"valkey",
Expand Down
35 changes: 6 additions & 29 deletions tests/test_asyncio/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
import pytest_asyncio
import valkey.asyncio as valkey
from tests.conftest import VALKEY_INFO
from valkey._parsers import _AsyncHiredisParser, _AsyncRESP2Parser
from valkey.asyncio import Sentinel
from valkey.asyncio.client import Monitor
from valkey.asyncio.connection import Connection, parse_url
from valkey.asyncio.retry import Retry
from valkey.backoff import NoBackoff
from valkey.utils import HIREDIS_AVAILABLE

from .compat import mock

Expand All @@ -26,41 +24,21 @@ async def _get_info(valkey_url):
@pytest_asyncio.fixture(
params=[
pytest.param(
(True, _AsyncRESP2Parser),
(True,),
marks=pytest.mark.skipif(
'config.VALKEY_INFO["cluster_enabled"]', reason="cluster mode enabled"
),
),
(False, _AsyncRESP2Parser),
pytest.param(
(True, _AsyncHiredisParser),
marks=[
pytest.mark.skipif(
'config.VALKEY_INFO["cluster_enabled"]',
reason="cluster mode enabled",
),
pytest.mark.skipif(
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
),
],
),
pytest.param(
(False, _AsyncHiredisParser),
marks=pytest.mark.skipif(
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
),
),
(False,),
],
ids=[
"single-python-parser",
"pool-python-parser",
"single-hiredis",
"pool-hiredis",
"single",
"pool",
],
)
async def create_valkey(request):
"""Wrapper around valkey.create_valkey."""
single_connection, parser_cls = request.param
(single_connection,) = request.param

teardown_clients = []

Expand All @@ -76,10 +54,9 @@ async def client_factory(
cluster_mode = VALKEY_INFO["cluster_enabled"]
if not cluster_mode:
single = kwargs.pop("single_connection_client", False) or single_connection
parser_class = kwargs.pop("parser_class", None) or parser_cls
url_options = parse_url(url)
url_options.update(kwargs)
pool = valkey.ConnectionPool(parser_class=parser_class, **url_options)
pool = valkey.ConnectionPool(**url_options)
client = cls(connection_pool=pool)
else:
client = valkey.ValkeyCluster.from_url(url, **kwargs)
Expand Down
25 changes: 25 additions & 0 deletions tests/test_asyncio/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2919,6 +2919,31 @@ async def test_xinfo_stream(self, r: valkey.Valkey):
assert info["first-entry"] == await get_stream_message(r, stream, m1)
assert info["last-entry"] == await get_stream_message(r, stream, m2)

await r.xtrim(stream, 0)
info = await r.xinfo_stream(stream)
assert info["length"] == 0
assert info["first-entry"] is None
assert info["last-entry"] is None

@skip_if_server_version_lt("6.0.0")
async def test_xinfo_stream_full(self, r: valkey.Valkey):
stream = "stream"
group = "group"

await r.xadd(stream, {"foo": "bar"})
info = await r.xinfo_stream(stream, full=True)
assert info["length"] == 1
assert len(info["groups"]) == 0

await r.xgroup_create(stream, group, 0)
info = await r.xinfo_stream(stream, full=True)
assert info["length"] == 1

await r.xreadgroup(group, "consumer", streams={stream: ">"})
info = await r.xinfo_stream(stream, full=True)
consumer = info["groups"][0]["consumers"][0]
assert isinstance(consumer, dict)

@skip_if_server_version_lt("5.0.0")
async def test_xlen(self, r: valkey.Valkey):
stream = "stream"
Expand Down
Loading
Loading