Skip to content

Commit 0609fc5

Browse files
committed
Investigate failing integration tests with Python 3.9
1 parent 1c474e5 commit 0609fc5

File tree

3 files changed

+20
-69
lines changed

3 files changed

+20
-69
lines changed

.github/workflows/integration.yaml

Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,6 @@ jobs:
4444
ignore-vulns: |
4545
GHSA-w596-4wvx-j9j6 # subversion related git pull, dependency for pytest. There is no impact here.
4646
47-
lint:
48-
name: Code linters
49-
runs-on: ubuntu-latest
50-
steps:
51-
- uses: actions/checkout@v5
52-
- uses: actions/setup-python@v6
53-
with:
54-
python-version: 3.9
55-
cache: 'pip'
56-
- name: run code linters
57-
run: |
58-
pip install -r dev_requirements.txt
59-
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
60-
invoke linters
61-
6247
redis_version:
6348
runs-on: ubuntu-latest
6449
outputs:
@@ -76,8 +61,8 @@ jobs:
7661
max-parallel: 15
7762
fail-fast: false
7863
matrix:
79-
redis-version: ['8.4-M01-pre', '${{ needs.redis_version.outputs.CURRENT }}', '8.0.2' ,'7.4.4', '7.2.9']
80-
python-version: ['3.9', '3.13']
64+
redis-version: ['${{ needs.redis_version.outputs.CURRENT }}']
65+
python-version: ['3.9']
8166
parser-backend: ['plain']
8267
event-loop: ['asyncio']
8368
env:
@@ -101,7 +86,7 @@ jobs:
10186
fail-fast: false
10287
matrix:
10388
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
104-
python-version: ['3.10', '3.11', '3.12', 'pypy-3.9', 'pypy-3.10']
89+
python-version: ['pypy-3.9', 'pypy-3.10']
10590
parser-backend: [ 'plain' ]
10691
event-loop: [ 'asyncio' ]
10792
env:
@@ -116,32 +101,6 @@ jobs:
116101
parser-backend: ${{ matrix.parser-backend }}
117102
redis-version: ${{ matrix.redis-version }}
118103

119-
hiredis-tests:
120-
runs-on: ubuntu-latest
121-
needs: [redis_version, tests]
122-
timeout-minutes: 60
123-
strategy:
124-
max-parallel: 15
125-
fail-fast: false
126-
matrix:
127-
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
128-
python-version: [ '3.9', '3.13']
129-
parser-backend: [ 'hiredis' ]
130-
hiredis-version: [ '>=3.2.0', '<3.0.0' ]
131-
event-loop: [ 'asyncio' ]
132-
env:
133-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
134-
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}} (${{ matrix.hiredis-version }}); EL:${{matrix.event-loop}}
135-
steps:
136-
- uses: actions/checkout@v5
137-
- name: Run tests
138-
uses: ./.github/actions/run-tests
139-
with:
140-
python-version: ${{ matrix.python-version }}
141-
parser-backend: ${{ matrix.parser-backend }}
142-
redis-version: ${{ matrix.redis-version }}
143-
hiredis-version: ${{ matrix.hiredis-version }}
144-
145104
uvloop-tests:
146105
runs-on: ubuntu-latest
147106
needs: [redis_version, tests]
@@ -151,7 +110,7 @@ jobs:
151110
fail-fast: false
152111
matrix:
153112
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
154-
python-version: [ '3.9', '3.13' ]
113+
python-version: [ '3.9']
155114
parser-backend: [ 'plain' ]
156115
event-loop: [ 'uvloop' ]
157116
env:
@@ -167,33 +126,14 @@ jobs:
167126
redis-version: ${{ matrix.redis-version }}
168127
event-loop: ${{ matrix.event-loop }}
169128

170-
build-and-test-package:
171-
name: Validate building and installing the package
172-
runs-on: ubuntu-latest
173-
needs: [tests]
174-
strategy:
175-
fail-fast: false
176-
matrix:
177-
extension: ['tar.gz', 'whl']
178-
steps:
179-
- uses: actions/checkout@v5
180-
- uses: actions/setup-python@v6
181-
with:
182-
python-version: 3.9
183-
- name: Run installed unit tests
184-
env:
185-
CLIENT_LIBS_TEST_IMAGE_TAG: ${{ env.CURRENT_REDIS_VERSION }}
186-
CLIENT_LIBS_TEST_STACK_IMAGE_TAG: ${{ env.CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG }}
187-
run: |
188-
bash .github/workflows/install_and_test.sh ${{ matrix.extension }}
189129

190130
install-package-from-commit:
191131
name: Install package from commit hash
192132
runs-on: ubuntu-latest
193133
strategy:
194134
fail-fast: false
195135
matrix:
196-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
136+
python-version: ['3.9', 'pypy-3.9', 'pypy-3.10']
197137
steps:
198138
- uses: actions/checkout@v5
199139
- uses: actions/setup-python@v6

dev_requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ pytest-profiling==1.8.1
1010
pytest-timeout
1111
ruff==0.9.6
1212
ujson>=4.2.0
13-
uvloop
13+
uvloop<=0.21.0; platform_python_implementation == "CPython"
1414
vulture>=2.3.0
15-
numpy>=1.24.0
15+
numpy>=1.24.0 ; platform_python_implementation == "CPython"
16+
numpy>=1.24.0,<2.0 ; platform_python_implementation == "PyPy"
1617
redis-entraid==1.0.0
1718
pybreaker>=1.4.0

tests/test_multiprocessing.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ class TestMultiprocessing:
2323
# The code in this module does not work with it,
2424
# hence the explicit change to 'fork'
2525
# See https://github.com/python/cpython/issues/125714
26+
print(f"*****************Start method: {multiprocessing.get_start_method()}")
2627
if multiprocessing.get_start_method() in ["forkserver", "spawn"]:
28+
print("Using fork _mp_context")
2729
_mp_context = multiprocessing.get_context(method="fork")
2830
else:
2931
_mp_context = multiprocessing.get_context()
@@ -80,14 +82,18 @@ def target(conn, ev):
8082
with pytest.raises(ConnectionError):
8183
conn.send_command("ping")
8284

83-
ev = multiprocessing.Event()
85+
ev = self._mp_context.Event()
8486
proc = self._mp_context.Process(target=target, args=(conn, ev))
8587
proc.start()
8688

8789
conn.disconnect()
8890
ev.set()
8991

9092
proc.join(3)
93+
if proc.exitcode is None:
94+
proc.terminate()
95+
proc.join(3)
96+
pytest.xfail("Intermittent PyPy/Linux fork+Event hang; see pypy/pypy#5268")
9197
assert proc.exitcode == 0
9298

9399
@pytest.mark.parametrize("max_connections", [2, None])
@@ -185,14 +191,18 @@ def target(pool, disconnect_event):
185191
assert conn.send_command("ping") is None
186192
assert conn.read_response() == b"PONG"
187193

188-
ev = multiprocessing.Event()
194+
ev = self._mp_context.Event()
189195

190196
proc = self._mp_context.Process(target=target, args=(pool, ev))
191197
proc.start()
192198

193199
pool.disconnect()
194200
ev.set()
195201
proc.join(3)
202+
if proc.exitcode is None:
203+
proc.terminate()
204+
proc.join(3)
205+
pytest.xfail("Intermittent PyPy/Linux fork+Event hang; see pypy/pypy#5268")
196206
assert proc.exitcode == 0
197207

198208
def test_redis_client(self, r):

0 commit comments

Comments
 (0)