Skip to content

Commit 2d7ac28

Browse files
committed
Adding unit text fixes to improve compatibility with MacOS.
1 parent b2dd8e8 commit 2d7ac28

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ services:
103103
- all
104104

105105
redis-stack:
106-
image: ${REDIS_STACK_IMAGE:-redis/redis-stack-server:edge}
106+
image: ${REDIS_STACK_IMAGE:-redis/redis-stack-server:latest}
107107
container_name: redis-stack
108108
ports:
109109
- 6479:6379
@@ -112,6 +112,7 @@ services:
112112
profiles:
113113
- standalone
114114
- all-stack
115+
- all
115116

116117
redis-stack-graph:
117118
image: redis/redis-stack-server:6.2.6-v15

tests/test_asyncio/test_connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import socket
33
import types
4+
from errno import ECONNREFUSED
45
from unittest.mock import patch
56

67
import pytest
@@ -534,7 +535,8 @@ async def test_network_connection_failure():
534535
with pytest.raises(ConnectionError) as e:
535536
redis = Redis(host="127.0.0.1", port=9999)
536537
await redis.set("a", "b")
537-
assert str(e.value).startswith("Error 111 connecting to 127.0.0.1:9999. Connect")
538+
expected_err = f"Error {ECONNREFUSED} connecting to 127.0.0.1:9999. Connect"
539+
assert str(e.value).startswith(expected_err)
538540

539541

540542
async def test_unix_socket_connection_failure():

tests/test_connection.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import threading
66
import types
7+
from errno import ECONNREFUSED
78
from typing import Any
89
from unittest import mock
910
from unittest.mock import call, patch
@@ -352,7 +353,11 @@ def test_network_connection_failure():
352353
with pytest.raises(ConnectionError) as e:
353354
redis = Redis(port=9999)
354355
redis.set("a", "b")
355-
assert str(e.value) == "Error 111 connecting to localhost:9999. Connection refused."
356+
357+
assert (
358+
str(e.value)
359+
== f"Error {ECONNREFUSED} connecting to localhost:9999. Connection refused."
360+
)
356361

357362

358363
def test_unix_socket_connection_failure():

tests/test_multiprocessing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import contextlib
22
import multiprocessing
3+
import sys
34

45
import pytest
56
import redis
@@ -8,6 +9,9 @@
89

910
from .conftest import _get_client
1011

12+
if sys.platform == "darwin":
13+
multiprocessing.set_start_method("fork", force=True)
14+
1115

1216
@contextlib.contextmanager
1317
def exit_callback(callback, *args):

0 commit comments

Comments
 (0)