Skip to content

Commit 953f162

Browse files
authored
[CI] Fix linter, test, and docs CI failures (#1572)
1 parent a9a1dae commit 953f162

8 files changed

Lines changed: 16 additions & 6 deletions

File tree

.github/unittest/linux/scripts/setup_env.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ if [ "${PYTHON_VERSION}" == "3.14t" ]; then
9494
# Install test dependencies (mirrors environment.yml)
9595
pip install pybind11 numpy expecttest pyyaml hypothesis future cloudpickle \
9696
pytest pytest-benchmark pytest-cov pytest-mock pytest-instafail \
97-
pytest-rerunfailures pytest-timeout coverage h5py orjson ninja protobuf redis
98-
# Note: mosaicml-streaming may not be available for 3.14t yet, skip if fails
97+
pytest-rerunfailures pytest-timeout coverage ninja protobuf redis
98+
# h5py, orjson and mosaicml-streaming may not be available for 3.14t yet
99+
pip install h5py || echo "h5py not available for Python 3.14t, skipping"
100+
pip install orjson || echo "orjson not available for Python 3.14t, skipping"
99101
pip install mosaicml-streaming || echo "mosaicml-streaming not available for Python 3.14t, skipping"
100102
else
101103
# For regular Python, use conda

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ jobs:
5555
eval "$(./conda/bin/conda shell.bash hook)"
5656
conda activate "./env"
5757
58-
# Install PyTorch (CPU version for docs)
59-
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U --quiet --root-user-action=ignore
58+
# Install PyTorch and torchvision (CPU version for docs)
59+
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu -U --quiet --root-user-action=ignore
6060
6161
# Install tensordict runtime deps explicitly (except torch which is handled above),
6262
# then install tensordict without resolving dependencies to avoid any solver changing the

benchmarks/storage/bench_redis.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import time
1717

1818
import torch
19-
2019
from tensordict import TensorDict
2120

2221
_has_redis_pkg = importlib.util.find_spec("redis", None) is not None

tensordict/redis.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from typing import Any, Callable, Tuple, Type, TYPE_CHECKING
1818

1919
import torch
20-
2120
from tensordict._td import (
2221
_TensorDictKeysView,
2322
_unravel_key_to_tuple,

test/test_h5.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def test_h5_nontensor(self, tmpdir):
100100
assert is_non_tensor(td_recover.get(("g", "h")))
101101

102102

103+
@pytest.mark.skipif(not _has_h5py, reason="h5py not found.")
103104
def test_auto_batch_size(tmpdir):
104105
tmpdir = Path(tmpdir)
105106
td = TensorDict(

test/test_setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import shutil
55
import subprocess
66
import sys
7+
import sysconfig
78
import venv
89
from pathlib import Path
910

@@ -102,6 +103,10 @@ def test_install_strategies_version(
102103
):
103104
if shutil.which("cmake") is None:
104105
pytest.skip("cmake not available")
106+
if no_build_isolation and sysconfig.get_config_var("Py_GIL_DISABLED"):
107+
pytest.skip(
108+
"no-build-isolation installs are unreliable on free-threaded Python"
109+
)
105110

106111
base_version = (_ROOT / "version.txt").read_text().strip()
107112
if not base_version:

test/test_tensorclass.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
pytest.mark.filterwarnings(
6868
"ignore:You are using `torch.load` with `weights_only=False`"
6969
),
70+
pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning"),
7071
]
7172

7273
IS_FB = os.getenv("PYTORCH_TEST_FBCODE")

test/test_tensordict.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
pytest.mark.filterwarnings(
160160
"ignore:No PYTORCH_KERNEL_CACHE_PATH or HOME environment variable set"
161161
),
162+
pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning"),
162163
]
163164

164165
mp_ctx = "spawn"
@@ -12795,6 +12796,8 @@ def test_map_seed_single(self):
1279512796
@pytest.mark.parametrize("h5", [False, True])
1279612797
@pytest.mark.parametrize("has_out", [False, True])
1279712798
def test_index_with_generator(self, chunksize, num_chunks, h5, has_out, tmpdir):
12799+
if h5 and not _has_h5py:
12800+
pytest.skip("h5py not installed")
1279812801
gc.collect()
1279912802
input = TensorDict({"a": torch.arange(10), "b": torch.arange(10)}, [10])
1280012803
if h5:

0 commit comments

Comments
 (0)