Skip to content

Commit 9069a32

Browse files
authored
Stop free-threaded CI jobs failing in setup before tests run (#1089)
Three matrix entries were red without ever running pytest: an earlier setup step aborted under "bash -e", so "run tests" showed as skipped. Both causes were environment drift, not code. 3.13t (ubuntu + macos): hypothesis has no free-threaded 3.13 wheel and its source build pulls pyo3-ffi, which reports "PyO3 does not support the free-threaded build of CPython versions below 3.14". Install it best-effort. That alone is insufficient -- test_runningstats.py and test_scalene_json.py import hypothesis at module scope, and a collection error there interrupts the entire pytest session -- so both now call pytest.importorskip("hypothesis"), matching the convention already used for torch and numpy. 3.14t (ubuntu): "apt-get install -y gdb" exited 100 on a 404 for libc6-dbg, the image's package index being older than the mirror's contents. Run apt-get update first, and don't let a missing gdb stop the job -- it only feeds the optional, already-guarded "Collect crash backtraces" step. All four free-threaded jobs pass on this PR, up from one.
1 parent 57aead6 commit 9069a32

3 files changed

Lines changed: 35 additions & 6 deletions

File tree

.github/workflows/tests.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ jobs:
8787

8888
- name: install test dependencies
8989
run: |
90-
python3 -m pip install pytest pytest-asyncio hypothesis
90+
python3 -m pip install pytest pytest-asyncio
91+
# hypothesis ships no wheel for free-threaded CPython 3.13, and
92+
# building it from source fails there: its dependency chain pulls
93+
# pyo3-ffi, and "PyO3 does not support the free-threaded build of
94+
# CPython versions below 3.14". That aborted this step under
95+
# ``bash -e``, so the 3.13t jobs never reached ``run tests`` at all.
96+
# Install it best-effort; the two modules that need it call
97+
# pytest.importorskip("hypothesis") and skip when it's absent.
98+
python3 -m pip install hypothesis || echo "hypothesis unavailable; property-based tests will skip"
9199
# torch/JAX/TensorFlow may not be available on free-threaded Python builds
92100
python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu || true
93101
python3 -m pip install -e ".[test]" || python3 -m pip install -e .
@@ -97,7 +105,14 @@ jobs:
97105
run: |
98106
ulimit -c unlimited
99107
echo '/tmp/core.%e.%p' | sudo tee /proc/sys/kernel/core_pattern
100-
sudo apt-get install -y gdb
108+
# ``apt-get update`` first: the runner image ships a package index
109+
# that can be older than the mirror's contents, and installing gdb
110+
# then 404s on a superseded libc6-dbg. That failed the whole step
111+
# (exit 100), skipping ``run tests`` on 3.14t. gdb is only used by
112+
# the optional "Collect crash backtraces" step, so never let its
113+
# absence stop the job.
114+
sudo apt-get update || true
115+
sudo apt-get install -y gdb || echo "gdb unavailable; crash backtraces will be skipped"
101116
102117
- name: Quick memory profiling smoke test
103118
if: runner.os == 'Linux' && endsWith(matrix.python, 't')

tests/test_runningstats.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
from scalene import runningstats
22

3-
import hypothesis.strategies as st
43
import math
4+
import pytest
55

6-
from hypothesis import given
76
from typing import List
87

8+
# hypothesis has no wheel for free-threaded CPython 3.13 and its source
9+
# build fails there (PyO3 doesn't support free-threaded < 3.14), so CI
10+
# installs it best-effort. Skip rather than error out collection.
11+
pytest.importorskip("hypothesis")
12+
13+
import hypothesis.strategies as st # noqa: E402
14+
15+
from hypothesis import given # noqa: E402
16+
917
TOLERANCE = 0.5
1018

1119

tests/test_scalene_json.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
from scalene import scalene_json
22

3-
from hypothesis import given
4-
from hypothesis.strategies import floats, lists
3+
import pytest
54

65
from typing import Any, List
76

7+
# See tests/test_runningstats.py: hypothesis is installed best-effort in CI
8+
# because it can't be built for free-threaded CPython 3.13.
9+
pytest.importorskip("hypothesis")
10+
11+
from hypothesis import given # noqa: E402
12+
from hypothesis.strategies import floats, lists # noqa: E402
13+
814

915
class TestScaleneJSON:
1016
# Define strategies for the input variables

0 commit comments

Comments
 (0)