Skip to content

Commit dcdbde3

Browse files
authored
Merge pull request redis#15 from mkmkme/mkmkme/get-old-versions-back
Revert redis#8 and replace "redis" and "old valkey" with "server"
2 parents 9bf21b4 + 574d6b3 commit dcdbde3

25 files changed

+727
-33
lines changed

tests/test_asyncio/test_cluster.py

Lines changed: 83 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_asyncio/test_commands.py

Lines changed: 145 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_asyncio/test_connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import pytest
77
import valkey
8+
from tests.conftest import skip_if_server_version_lt
89
from valkey._parsers import (
910
_AsyncHiredisParser,
1011
_AsyncRESP2Parser,
@@ -89,6 +90,7 @@ async def get_conn(_):
8990
await r.aclose()
9091

9192

93+
@skip_if_server_version_lt("4.0.0")
9294
@pytest.mark.valkeymod
9395
@pytest.mark.onlynoncluster
9496
async def test_loading_external_modules(r):

tests/test_asyncio/test_connection_pool.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55
import pytest_asyncio
66
import valkey.asyncio as valkey
7+
from tests.conftest import skip_if_server_version_lt
78
from valkey.asyncio.connection import Connection, to_bool
89

910
from .compat import aclosing, mock
@@ -317,11 +318,13 @@ def test_port(self):
317318
assert pool.connection_class == valkey.Connection
318319
assert pool.connection_kwargs == {"host": "localhost", "port": 6380}
319320

321+
@skip_if_server_version_lt("6.0.0")
320322
def test_username(self):
321323
pool = valkey.ConnectionPool.from_url("valkey://myuser:@localhost")
322324
assert pool.connection_class == valkey.Connection
323325
assert pool.connection_kwargs == {"host": "localhost", "username": "myuser"}
324326

327+
@skip_if_server_version_lt("6.0.0")
325328
def test_quoted_username(self):
326329
pool = valkey.ConnectionPool.from_url(
327330
"valkey://%2Fmyuser%2F%2B name%3D%24+:@localhost"
@@ -347,6 +350,7 @@ def test_quoted_password(self):
347350
"password": "/mypass/+ word=$+",
348351
}
349352

353+
@skip_if_server_version_lt("6.0.0")
350354
def test_username_and_password(self):
351355
pool = valkey.ConnectionPool.from_url("valkey://myuser:mypass@localhost")
352356
assert pool.connection_class == valkey.Connection
@@ -473,11 +477,13 @@ def test_defaults(self):
473477
assert pool.connection_class == valkey.UnixDomainSocketConnection
474478
assert pool.connection_kwargs == {"path": "/socket"}
475479

480+
@skip_if_server_version_lt("6.0.0")
476481
def test_username(self):
477482
pool = valkey.ConnectionPool.from_url("unix://myuser:@/socket")
478483
assert pool.connection_class == valkey.UnixDomainSocketConnection
479484
assert pool.connection_kwargs == {"path": "/socket", "username": "myuser"}
480485

486+
@skip_if_server_version_lt("6.0.0")
481487
def test_quoted_username(self):
482488
pool = valkey.ConnectionPool.from_url(
483489
"unix://%2Fmyuser%2F%2B name%3D%24+:@/socket"
@@ -581,6 +587,7 @@ async def test_on_connect_error(self):
581587
assert not pool._available_connections[0]._reader
582588

583589
@pytest.mark.onlynoncluster
590+
@skip_if_server_version_lt("2.8.8")
584591
async def test_busy_loading_disconnects_socket(self, r):
585592
"""
586593
If Valkey raises a LOADING error, the connection should be
@@ -592,6 +599,7 @@ async def test_busy_loading_disconnects_socket(self, r):
592599
assert not r.connection._reader
593600

594601
@pytest.mark.onlynoncluster
602+
@skip_if_server_version_lt("2.8.8")
595603
async def test_busy_loading_from_pipeline_immediate_command(self, r):
596604
"""
597605
BusyLoadingErrors should raise from Pipelines that execute a
@@ -608,6 +616,7 @@ async def test_busy_loading_from_pipeline_immediate_command(self, r):
608616
assert not pool._available_connections[0]._reader
609617

610618
@pytest.mark.onlynoncluster
619+
@skip_if_server_version_lt("2.8.8")
611620
async def test_busy_loading_from_pipeline(self, r):
612621
"""
613622
BusyLoadingErrors should be raised from a pipeline execution
@@ -622,6 +631,7 @@ async def test_busy_loading_from_pipeline(self, r):
622631
assert len(pool._available_connections) == 1
623632
assert not pool._available_connections[0]._reader
624633

634+
@skip_if_server_version_lt("2.8.8")
625635
async def test_read_only_error(self, r):
626636
"""READONLY errors get turned into ReadOnlyError exceptions"""
627637
with pytest.raises(valkey.ReadOnlyError):
@@ -666,11 +676,7 @@ async def test_connect_no_auth_supplied_when_required(self, r):
666676
"""
667677
with pytest.raises(valkey.AuthenticationError):
668678
await r.execute_command(
669-
"DEBUG",
670-
"ERROR",
671-
"ERR AUTH <password> called without any password "
672-
"configured for the default user. Are you sure "
673-
"your configuration is correct?",
679+
"DEBUG", "ERROR", "ERR Client sent AUTH, but no password is set"
674680
)
675681

676682
async def test_connect_invalid_password_supplied(self, r):

tests/test_asyncio/test_pipeline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
import valkey
3+
from tests.conftest import skip_if_server_version_lt
34

45
from .compat import aclosing, mock
56
from .conftest import wait_for_command
@@ -392,6 +393,7 @@ async def test_pipeline_get(self, r):
392393
assert await pipe.execute() == [b"a1"]
393394

394395
@pytest.mark.onlynoncluster
396+
@skip_if_server_version_lt("2.0.0")
395397
async def test_pipeline_discard(self, r):
396398
# empty pipeline should raise an error
397399
async with r.pipeline() as pipe:

tests/test_asyncio/test_pubsub.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import pytest
1616
import pytest_asyncio
1717
import valkey.asyncio as valkey
18-
from tests.conftest import get_protocol_version
18+
from tests.conftest import get_protocol_version, skip_if_server_version_lt
1919
from valkey.exceptions import ConnectionError
2020
from valkey.typing import EncodableT
2121
from valkey.utils import HIREDIS_AVAILABLE
@@ -608,6 +608,7 @@ async def test_channel_subscribe(self, r: valkey.Valkey):
608608
@pytest.mark.onlynoncluster
609609
class TestPubSubSubcommands:
610610
@pytest.mark.onlynoncluster
611+
@skip_if_server_version_lt("2.8.0")
611612
async def test_pubsub_channels(self, r: valkey.Valkey, pubsub):
612613
p = pubsub
613614
await p.subscribe("foo", "bar", "baz", "quux")
@@ -617,6 +618,7 @@ async def test_pubsub_channels(self, r: valkey.Valkey, pubsub):
617618
assert all([channel in await r.pubsub_channels() for channel in expected])
618619

619620
@pytest.mark.onlynoncluster
621+
@skip_if_server_version_lt("2.8.0")
620622
async def test_pubsub_numsub(self, r: valkey.Valkey):
621623
p1 = r.pubsub()
622624
await p1.subscribe("foo", "bar", "baz")
@@ -636,6 +638,7 @@ async def test_pubsub_numsub(self, r: valkey.Valkey):
636638
await p2.aclose()
637639
await p3.aclose()
638640

641+
@skip_if_server_version_lt("2.8.0")
639642
async def test_pubsub_numpat(self, r: valkey.Valkey):
640643
p = r.pubsub()
641644
await p.psubscribe("*oo", "*ar", "b*z")
@@ -647,6 +650,7 @@ async def test_pubsub_numpat(self, r: valkey.Valkey):
647650

648651
@pytest.mark.onlynoncluster
649652
class TestPubSubPings:
653+
@skip_if_server_version_lt("3.0.0")
650654
async def test_send_pubsub_ping(self, r: valkey.Valkey):
651655
p = r.pubsub(ignore_subscribe_messages=True)
652656
await p.subscribe("foo")
@@ -656,6 +660,7 @@ async def test_send_pubsub_ping(self, r: valkey.Valkey):
656660
)
657661
await p.aclose()
658662

663+
@skip_if_server_version_lt("3.0.0")
659664
async def test_send_pubsub_ping_message(self, r: valkey.Valkey):
660665
p = r.pubsub(ignore_subscribe_messages=True)
661666
await p.subscribe("foo")
@@ -668,6 +673,7 @@ async def test_send_pubsub_ping_message(self, r: valkey.Valkey):
668673

669674
@pytest.mark.onlynoncluster
670675
class TestPubSubConnectionKilled:
676+
@skip_if_server_version_lt("3.0.0")
671677
async def test_connection_error_raised_when_connection_dies(
672678
self, r: valkey.Valkey, pubsub
673679
):

tests/test_asyncio/test_scripting.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
import pytest_asyncio
3+
from tests.conftest import skip_if_server_version_lt
34
from valkey import exceptions
45

56
multiply_script = """
@@ -35,6 +36,7 @@ async def test_eval(self, r):
3536
assert await r.eval(multiply_script, 1, "a", 3) == 6
3637

3738
@pytest.mark.asyncio(forbid_global_loop=True)
39+
@skip_if_server_version_lt("6.2.0")
3840
async def test_script_flush(self, r):
3941
await r.set("a", 2)
4042
await r.script_load(multiply_script)

0 commit comments

Comments
 (0)