From 771b9b28cd78a8bebae4e115c07c588d0436efd1 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 4 Dec 2024 15:29:51 -0800 Subject: [PATCH] Speed up tests --- .github/workflows/_test_langgraph.yml | 2 +- libs/langgraph/Makefile | 6 ++++++ libs/langgraph/tests/test_pregel.py | 1 - libs/langgraph/tests/test_pregel_async.py | 3 --- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/_test_langgraph.yml b/.github/workflows/_test_langgraph.yml index 5c3f5182e..2708d0f23 100644 --- a/.github/workflows/_test_langgraph.yml +++ b/.github/workflows/_test_langgraph.yml @@ -60,7 +60,7 @@ jobs: env: LANGGRAPH_FF_SEND_V2: ${{ matrix.ff-send-v2 }} run: | - make test + make test_parallel - name: Ensure the tests did not create any additional files shell: bash diff --git a/libs/langgraph/Makefile b/libs/langgraph/Makefile index 43d0c7afe..8974fcd32 100644 --- a/libs/langgraph/Makefile +++ b/libs/langgraph/Makefile @@ -48,6 +48,12 @@ test: make stop-postgres; \ exit $$EXIT_CODE +test_parallel: + make start-postgres && poetry run pytest -n auto --dist worksteal $(TEST); \ + EXIT_CODE=$$?; \ + make stop-postgres; \ + exit $$EXIT_CODE + WORKERS ?= auto XDIST_ARGS := $(if $(WORKERS),-n $(WORKERS) --dist worksteal,) MAXFAIL ?= diff --git a/libs/langgraph/tests/test_pregel.py b/libs/langgraph/tests/test_pregel.py index 68071594b..f69d36ed3 100644 --- a/libs/langgraph/tests/test_pregel.py +++ b/libs/langgraph/tests/test_pregel.py @@ -1969,7 +1969,6 @@ def test_send_sequences() -> None: ) -@pytest.mark.repeat(20) @pytest.mark.parametrize("checkpointer_name", ALL_CHECKPOINTERS_SYNC) def test_send_dedupe_on_resume( request: pytest.FixtureRequest, checkpointer_name: str diff --git a/libs/langgraph/tests/test_pregel_async.py b/libs/langgraph/tests/test_pregel_async.py index 538730c78..514703781 100644 --- a/libs/langgraph/tests/test_pregel_async.py +++ b/libs/langgraph/tests/test_pregel_async.py @@ -847,7 +847,6 @@ async def test_node_not_cancelled_on_other_node_interrupted( assert awhiles == 1 -@pytest.mark.repeat(10) async def test_step_timeout_on_stream_hang() -> None: inner_task_cancelled = False @@ -2559,7 +2558,6 @@ async def test_concurrent_emit_sends() -> None: ) -@pytest.mark.repeat(10) @pytest.mark.parametrize("checkpointer_name", ALL_CHECKPOINTERS_ASYNC) async def test_send_sequences(checkpointer_name: str) -> None: class Node: @@ -2649,7 +2647,6 @@ async def test_send_sequences(checkpointer_name: str) -> None: ] -@pytest.mark.repeat(20) @pytest.mark.parametrize("checkpointer_name", ALL_CHECKPOINTERS_ASYNC) async def test_send_dedupe_on_resume(checkpointer_name: str) -> None: if not FF_SEND_V2: