test: add tests for observability, build_subgraph, helpers, and concurrency - #34
Merged
Conversation
…rrency - Add test_observability.py: 5 tests covering setup_observability with auto_instrument on/off, instrumentor invocation, None/empty lists - Add test_build_subgraph.py: 8 tests covering linear wiring, single-node, input_cls, name, checkpointer, empty nodes, and ImportError fallback - Add test_helpers.py: 20 tests for _parse_expected (list, string literal, numeric, URL, None, tuple, nested) and _zero_value_for (bool, int, etc.) - Extend test_runner.py: 6 tests for concurrent execution (concurrency=2+, async tasks in parallel) and _get_thread_event_loop (reuse, closed-loop recreation, thread isolation) Coverage improved from 89% to 95%. Modules observability.py and langgraph.py now at 100% (previously 38% and 26%).
Avoids ty unresolved-import error in CI where langgraph is not installed. Uses pytest.importorskip instead of a direct import to stay consistent with the existing test_task_async.py pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_observability.py(5 tests) —setup_observabilitywithauto_instrumenton/off, instrumentor invocation,Noneand empty instrumentor liststest_build_subgraph.py(8 tests) — Linear edge wiring, single-node graph,input_cls,name,checkpointer(InMemorySaver), empty nodesIndexError,ImportErrorwithout langgraphtest_helpers.py(20 tests) —_parse_expectededge cases (list, string literal, numeric, URL, None, tuple, nested, boolean) and_zero_value_for(bool, int, float, str, None, custom type)Extended test file
test_runner.py(+6 tests) — Concurrent execution withconcurrency=2+, async tasks in parallel,_get_thread_event_loopreuse/closed-loop recreation/thread isolationNotes
test_build_subgraph.pytests are gated behindpytest.importorskip("langgraph")and will be skipped in CI without the langgraph extratest_observability.pymocksphoenix.otel.registerto avoid requiring a Phoenix server