Skip to content

Commit

Permalink
Adding unit text fixes to improve compatibility with MacOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
petyaslavova committed Jan 24, 2025
1 parent b2dd8e8 commit 2d7ac28
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ services:
- all

redis-stack:
image: ${REDIS_STACK_IMAGE:-redis/redis-stack-server:edge}
image: ${REDIS_STACK_IMAGE:-redis/redis-stack-server:latest}
container_name: redis-stack
ports:
- 6479:6379
Expand All @@ -112,6 +112,7 @@ services:
profiles:
- standalone
- all-stack
- all

redis-stack-graph:
image: redis/redis-stack-server:6.2.6-v15
Expand Down
4 changes: 3 additions & 1 deletion tests/test_asyncio/test_connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import socket
import types
from errno import ECONNREFUSED
from unittest.mock import patch

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


async def test_unix_socket_connection_failure():
Expand Down
7 changes: 6 additions & 1 deletion tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import threading
import types
from errno import ECONNREFUSED
from typing import Any
from unittest import mock
from unittest.mock import call, patch
Expand Down Expand Up @@ -352,7 +353,11 @@ def test_network_connection_failure():
with pytest.raises(ConnectionError) as e:
redis = Redis(port=9999)
redis.set("a", "b")
assert str(e.value) == "Error 111 connecting to localhost:9999. Connection refused."

assert (
str(e.value)
== f"Error {ECONNREFUSED} connecting to localhost:9999. Connection refused."
)


def test_unix_socket_connection_failure():
Expand Down
4 changes: 4 additions & 0 deletions tests/test_multiprocessing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import contextlib
import multiprocessing
import sys

import pytest
import redis
Expand All @@ -8,6 +9,9 @@

from .conftest import _get_client

if sys.platform == "darwin":
multiprocessing.set_start_method("fork", force=True)


@contextlib.contextmanager
def exit_callback(callback, *args):
Expand Down

0 comments on commit 2d7ac28

Please sign in to comment.