Skip to content

Commit 6cde4f2

Browse files
committed
fix(test): guard pyximport import for non-Cython tox envs
1 parent ca3036c commit 6cde4f2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

tests/unit/wiring/conftest.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
"""Enable on-import compilation of the .pyx wiring fixture via pyximport."""
1+
"""Enable on-import compilation of the .pyx wiring fixture via pyximport.
22
3-
import pyximport
3+
Cython is not installed in every tox env (e.g. pydantic-{v1,v2}), so the
4+
import is guarded — test_cython.py skips at importorskip in that case.
5+
"""
46

5-
pyximport.install(language_level=3)
7+
try:
8+
import pyximport
9+
10+
pyximport.install(language_level=3)
11+
except ImportError:
12+
pass

0 commit comments

Comments
 (0)