Skip to content

Commit a99f389

Browse files
committed
use a multi-connection client for multiprocess tests
1 parent f307878 commit a99f389

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_multiprocessing.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
import multiprocessing
33
import contextlib
44

5+
import redis
56
from redis.connection import Connection, ConnectionPool
67
from redis.exceptions import ConnectionError
78

9+
from .conftest import _get_client
10+
811

912
@contextlib.contextmanager
1013
def exit_callback(callback, *args):
@@ -18,6 +21,15 @@ class TestMultiprocessing(object):
1821
# Test connection sharing between forks.
1922
# See issue #1085 for details.
2023

24+
# use a multi-connection client as that's the only type that is
25+
# actuall fork/process-safe
26+
@pytest.fixture()
27+
def r(self, request):
28+
return _get_client(
29+
redis.Redis,
30+
request=request,
31+
single_connection_client=False)
32+
2133
def test_close_connection_in_child(self):
2234
"""
2335
A connection owned by a parent and closed by a child doesn't

0 commit comments

Comments
 (0)