Skip to content

Commit ac683ee

Browse files
committed
fix(tests): skip langmem tests on Python 3.10
Add Python version check to skip langmem serialization tests on Python < 3.11. The langmem library uses typing.NotRequired which was introduced in Python 3.11, causing import failures on Python 3.10 in CI. Tests will: - Skip on Python 3.10 (379 tests run) - Run on Python 3.11+ (382 tests run) Fixes CI test collection failures on Python 3.10.
1 parent a39049e commit ac683ee

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/test_langmem_serialization.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
"""Integration tests for langmem object serialization with JsonPlusRedisSerializer."""
22

3+
import sys
4+
35
import pytest
4-
from langmem.short_term.summarization import RunningSummary
56

67
from langgraph.checkpoint.redis.jsonplus_redis import JsonPlusRedisSerializer
78

9+
# langmem requires Python 3.11+ (uses typing.NotRequired)
10+
# Try to import, skip all tests if it fails
11+
try:
12+
from langmem.short_term.summarization import RunningSummary
13+
except (ImportError, AttributeError):
14+
# Skip entire module if langmem can't be imported (Python < 3.11)
15+
pytestmark = pytest.mark.skip(
16+
reason="langmem requires Python 3.11+ (uses typing.NotRequired)"
17+
)
18+
RunningSummary = None # type: ignore
19+
820

921
class TestLangmemSerialization:
1022
"""Test that langmem objects are properly serialized and deserialized."""

0 commit comments

Comments
 (0)