Skip to content

Commit 22038a6

Browse files
committed
Fix bug with partial Hiredis availability
1 parent 2e46613 commit 22038a6

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.github/workflows/integration.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,21 @@ jobs:
9090
invoke ${{matrix.test-type}}-tests
9191
ls -1
9292
93+
- name: Run tests against hiredis < 3.0.0
94+
if: ${{ matrix.connection-type == 'hiredis' && matrix.python-version == '3.12'}}
95+
run: |
96+
pip uninstall hiredis
97+
pip install -U setuptools wheel
98+
pip install -r requirements.txt
99+
pip install -r dev_requirements.txt
100+
if [ "${{matrix.connection-type}}" == "hiredis" ]; then
101+
pip install "hiredis<3.0.0"
102+
fi
103+
invoke devenv
104+
sleep 10 # time to settle
105+
invoke ${{matrix.test-type}}-tests
106+
ls -1
107+
93108
- name: Upload test results and profiling data
94109
uses: actions/upload-artifact@v4
95110
with:
@@ -145,6 +160,24 @@ jobs:
145160
invoke ${{matrix.test-type}}-tests --protocol=3
146161
fi
147162
163+
- name: Run tests against hiredis < 3.0.0
164+
if: ${{ matrix.connection-type == 'hiredis' && matrix.python-version == '3.12'}}
165+
run: |
166+
pip uninstall hiredis
167+
pip install -U setuptools wheel
168+
pip install -r requirements.txt
169+
pip install -r dev_requirements.txt
170+
if [ "${{matrix.connection-type}}" == "hiredis" ]; then
171+
pip install "hiredis<3.0.0"
172+
fi
173+
invoke devenv
174+
sleep 10 # time to settle
175+
if [ "${{matrix.event-loop}}" == "uvloop" ]; then
176+
invoke ${{matrix.test-type}}-tests --uvloop --protocol=3
177+
else
178+
invoke ${{matrix.test-type}}-tests --protocol=3
179+
fi
180+
148181
- name: Upload test results and profiling data
149182
uses: actions/upload-artifact@v4
150183
with:

redis/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88

99
# Only support Hiredis >= 3.0:
1010
HIREDIS_AVAILABLE = int(hiredis.__version__.split(".")[0]) >= 3
11+
if not HIREDIS_AVAILABLE:
12+
raise ImportError("hiredis package should be >= 3.0.0")
1113
HIREDIS_PACK_AVAILABLE = hasattr(hiredis, "pack_command")
14+
if not HIREDIS_PACK_AVAILABLE:
15+
raise ImportError("pack_command is not available in the current version of hiredis.")
1216
except ImportError:
1317
HIREDIS_AVAILABLE = False
1418
HIREDIS_PACK_AVAILABLE = False

0 commit comments

Comments
 (0)