Skip to content

Commit 876892f

Browse files
committed
Skip LangGraph functional API + interrupt tests on Python < 3.11
These features rely on contextvars propagation through asyncio.create_task(), which is only available in Python 3.11+. On 3.10 they hang rather than fail cleanly, so CI sat for an hour before today's fix landed. Mirrors the pytestmark skipif used in sdk-python's own contrib/langgraph tests.
1 parent 85a2ab1 commit 876892f

6 files changed

Lines changed: 42 additions & 0 deletions

tests/langgraph_plugin/functional_continue_as_new_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import sys
12
import uuid
23
from datetime import timedelta
34

5+
import pytest
46
from temporalio.client import Client
57
from temporalio.contrib.langgraph import LangGraphPlugin
68
from temporalio.worker import Worker
@@ -13,6 +15,11 @@
1315
pipeline_entrypoint,
1416
)
1517

18+
pytestmark = pytest.mark.skipif(
19+
sys.version_info < (3, 11),
20+
reason="LangGraph Functional API requires Python >= 3.11 for async context propagation",
21+
)
22+
1623

1724
async def test_functional_continue_as_new(client: Client) -> None:
1825
"""Input 10: 10*2=20 -> 20+50=70 -> 70*3=210."""

tests/langgraph_plugin/functional_control_flow_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import sys
12
import uuid
23

4+
import pytest
35
from temporalio.client import Client
46
from temporalio.contrib.langgraph import LangGraphPlugin
57
from temporalio.worker import Worker
@@ -11,6 +13,11 @@
1113
control_flow_pipeline,
1214
)
1315

16+
pytestmark = pytest.mark.skipif(
17+
sys.version_info < (3, 11),
18+
reason="LangGraph Functional API requires Python >= 3.11 for async context propagation",
19+
)
20+
1421

1522
async def test_functional_control_flow(client: Client) -> None:
1623
task_queue = f"functional-control-flow-test-{uuid.uuid4()}"

tests/langgraph_plugin/functional_hello_world_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import sys
12
import uuid
23

4+
import pytest
35
from temporalio.client import Client
46
from temporalio.contrib.langgraph import LangGraphPlugin
57
from temporalio.worker import Worker
@@ -11,6 +13,11 @@
1113
hello_entrypoint,
1214
)
1315

16+
pytestmark = pytest.mark.skipif(
17+
sys.version_info < (3, 11),
18+
reason="LangGraph Functional API requires Python >= 3.11 for async context propagation",
19+
)
20+
1421

1522
async def test_functional_hello_world(client: Client) -> None:
1623
task_queue = f"functional-hello-test-{uuid.uuid4()}"

tests/langgraph_plugin/functional_human_in_the_loop_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import asyncio
2+
import sys
23
import uuid
34

5+
import pytest
46
from temporalio.client import Client
57
from temporalio.contrib.langgraph import LangGraphPlugin
68
from temporalio.worker import Worker
@@ -12,6 +14,11 @@
1214
chatbot_entrypoint,
1315
)
1416

17+
pytestmark = pytest.mark.skipif(
18+
sys.version_info < (3, 11),
19+
reason="LangGraph Functional API and interrupt() require Python >= 3.11 for async context propagation",
20+
)
21+
1522

1623
async def test_functional_human_in_the_loop_approve(client: Client) -> None:
1724
task_queue = f"functional-hitl-test-{uuid.uuid4()}"

tests/langgraph_plugin/functional_react_agent_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import sys
12
import uuid
23

4+
import pytest
35
from temporalio.client import Client
46
from temporalio.contrib.langgraph import LangGraphPlugin
57
from temporalio.worker import Worker
@@ -11,6 +13,11 @@
1113
react_agent_entrypoint,
1214
)
1315

16+
pytestmark = pytest.mark.skipif(
17+
sys.version_info < (3, 11),
18+
reason="LangGraph Functional API requires Python >= 3.11 for async context propagation",
19+
)
20+
1421

1522
async def test_functional_react_agent(client: Client) -> None:
1623
task_queue = f"functional-react-agent-test-{uuid.uuid4()}"

tests/langgraph_plugin/human_in_the_loop_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import asyncio
2+
import sys
23
import uuid
34

5+
import pytest
46
from temporalio.client import Client
57
from temporalio.contrib.langgraph import LangGraphPlugin
68
from temporalio.worker import Worker
@@ -10,6 +12,11 @@
1012
make_chatbot_graph,
1113
)
1214

15+
pytestmark = pytest.mark.skipif(
16+
sys.version_info < (3, 11),
17+
reason="langgraph.types.interrupt() requires Python >= 3.11 for async context propagation",
18+
)
19+
1320

1421
async def test_human_in_the_loop_approve(client: Client) -> None:
1522
task_queue = f"hitl-test-{uuid.uuid4()}"

0 commit comments

Comments
 (0)