Skip to content

Commit 089a33b

Browse files
committed
fix: vjepa test files import order
1 parent e2fa413 commit 089a33b

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/tests/action_model_testing/vjepa/clips_without_coi_crop/rmm/test_extract_features.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from __future__ import annotations
99

10+
import importlib.machinery
1011
import os
1112
import sys
1213
import types
@@ -16,10 +17,14 @@
1617
# The module hard-imports `decord` at module load time. decord ships only as
1718
# manylinux wheels, so stub it out here for platforms/CI runners where it
1819
# isn't installed; the tests below never touch VideoReader/cpu directly.
20+
# A bare types.ModuleType leaves __spec__ as None, which later crashes
21+
# importlib.util.find_spec("decord") (e.g. transformers' optional-dep probing)
22+
# for any other test collected in this same pytest process, so give it a spec.
1923
if "decord" not in sys.modules:
2024
_decord_stub = types.ModuleType("decord")
2125
_decord_stub.VideoReader = object
2226
_decord_stub.cpu = lambda *args, **kwargs: None
27+
_decord_stub.__spec__ = importlib.machinery.ModuleSpec("decord", loader=None)
2328
sys.modules["decord"] = _decord_stub
2429

2530
# The module also calls os.makedirs(OUTPUT_BASE, ...) at import time against

src/tests/action_model_testing/vjepa/clips_without_coi_crop/test_extract_features.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from __future__ import annotations
99

10+
import importlib.machinery
1011
import os
1112
import sys
1213
import types
@@ -17,10 +18,14 @@
1718
# The module hard-imports `decord` at module load time. decord ships only as
1819
# manylinux wheels, so stub it out here for platforms/CI runners where it
1920
# isn't installed; the tests below never touch VideoReader/cpu directly.
21+
# A bare types.ModuleType leaves __spec__ as None, which later crashes
22+
# importlib.util.find_spec("decord") (e.g. transformers' optional-dep probing)
23+
# for any other test collected in this same pytest process, so give it a spec.
2024
if "decord" not in sys.modules:
2125
_decord_stub = types.ModuleType("decord")
2226
_decord_stub.VideoReader = object
2327
_decord_stub.cpu = lambda *args, **kwargs: None
28+
_decord_stub.__spec__ = importlib.machinery.ModuleSpec("decord", loader=None)
2429
sys.modules["decord"] = _decord_stub
2530

2631
# The module also calls os.makedirs(OUTPUT_BASE, ...) at import time against

0 commit comments

Comments
 (0)