From ffb8400b19591ef84f7a489f40a8d92a68c30c36 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 2 Apr 2025 14:05:15 -0700 Subject: [PATCH] Disable tests in 3.9 --- libs/langgraph/tests/test_checkpoint_migration.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/langgraph/tests/test_checkpoint_migration.py b/libs/langgraph/tests/test_checkpoint_migration.py index b8043351e..67e2efc1e 100644 --- a/libs/langgraph/tests/test_checkpoint_migration.py +++ b/libs/langgraph/tests/test_checkpoint_migration.py @@ -1,4 +1,5 @@ import operator +import sys import time from collections import defaultdict from typing import Annotated, Literal, Optional, Union @@ -24,6 +25,11 @@ from tests.conftest import ( pytestmark = pytest.mark.anyio +NEEDS_CONTEXTVARS = pytest.mark.skipif( + sys.version_info < (3, 11), + reason="Python 3.11+ is required for async contextvars support", +) + def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: return [ @@ -1534,6 +1540,7 @@ def make_state_graph() -> StateGraph: return workflow +@NEEDS_CONTEXTVARS @pytest.mark.parametrize("source,target", [("2-start:*", "3"), ("2-quadratic", "3")]) def test_migrate_checkpoints(source: str, target: str) -> None: # Check that the migration function works as expected @@ -1571,6 +1578,7 @@ def test_migrate_checkpoints(source: str, target: str) -> None: ), "Checkpoint mismatch at index {}".format(idx) +@NEEDS_CONTEXTVARS @pytest.mark.parametrize("checkpointer_name", REGULAR_CHECKPOINTERS_SYNC) def test_latest_checkpoint_state_graph( request: pytest.FixtureRequest, checkpointer_name: str @@ -1615,6 +1623,7 @@ def test_latest_checkpoint_state_graph( assert history[5] == expected_history[5] +@NEEDS_CONTEXTVARS @pytest.mark.parametrize("checkpointer_name", REGULAR_CHECKPOINTERS_ASYNC) async def test_latest_checkpoint_state_graph_async(checkpointer_name: str) -> None: async with awith_checkpointer(checkpointer_name) as checkpointer: @@ -1656,6 +1665,7 @@ async def test_latest_checkpoint_state_graph_async(checkpointer_name: str) -> No assert history[5] == expected_history[5] +@NEEDS_CONTEXTVARS @pytest.mark.parametrize("checkpoint_version", ["3", "2-start:*", "2-quadratic"]) @pytest.mark.parametrize("checkpointer_name", REGULAR_CHECKPOINTERS_SYNC) def test_saved_checkpoint_state_graph( @@ -1726,6 +1736,7 @@ def test_saved_checkpoint_state_graph( ) +@NEEDS_CONTEXTVARS @pytest.mark.parametrize("checkpoint_version", ["3", "2-start:*", "2-quadratic"]) @pytest.mark.parametrize("checkpointer_name", REGULAR_CHECKPOINTERS_ASYNC) async def test_saved_checkpoint_state_graph_async(