--- id: langchain-tests version: "1.1.9" license: MIT license_treatment: permissive maintenance: active --- # langchain-tests — Standard tests for LangChain implementations License: permissive · Maintenance: active · Downloads: 2.0M/mo ## What it is and what it does langchain-tests is a testing library that provides standardized test base classes and fixtures for validating LangChain integrations. It defines unit and integration test templates (e.g., ChatModelUnitTests, ChatModelIntegrationTests) that integration authors inherit from to ensure their implementations conform to LangChain's standard interfaces. The library bundles pytest plugins (pytest-asyncio, pytest-benchmark, pytest-recording, pytest-socket, vcrpy) and assertion tools (syrupy) to support deterministic, isolated testing. Integration packages use langchain-tests by creating test classes that inherit from the appropriate base and configure fixtures like chat_model_class and optional parameters such as tool-calling and structured-output capabilities. The library is actively maintained by the LangChain team and released frequently; the documentation explicitly recommends pinning to a specific version in CI to prevent unexpected test failures when new tests are introduced. Use it for: - Validate a custom chat model integration against LangChain's standard interface before publishing. - Ensure a third-party LLM provider integration passes unit and integration tests in CI/CD. - Add deterministic, recorded HTTP tests to an integration using pytest-recording and vcrpy. - Benchmark performance of a chat model integration with pytest-benchmark fixtures. - Test tool-calling and structured-output capabilities of a chat model implementation. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides standard test base classes and fixtures for validating LangChain integration implementations, particularly chat models, against a shared interface contract. Yes, if you are developing a LangChain integration (chat model, retriever, or other component). It provides the canonical test suite and fixtures the LangChain ecosystem expects, with low install friction and active maintenance. Not relevant for end users of LangChain who are not building integrations. Pin the version in your CI to avoid unexpected test additions breaking your pipeline. ## Install pip install langchain-tests uv add langchain-tests poetry add langchain-tests ## Installing langchain-tests Before you install: Low friction install with a pure-Python wheel. Active maintenance (last commit 2026-08-14) and recent release (2026-05-21). Documentation recommends pinning versions to avoid CI breakage when new tests are added. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal restrictions. Quickstart: pip install langchain-tests from langchain_tests.unit_tests import ChatModelUnitTests from langchain_core.language_models import BaseChatModel class TestMyModel(ChatModelUnitTests): @pytest.fixture def chat_model_class(self) -> Type[BaseChatModel]: return MyCustomChatModel Requires Python 3.10 or later; integrations must inherit from langchain-core base classes. Verify before relying: - Whether test coverage includes all LangChain integration types beyond chat models (e.g., retrievers, agents). - Performance impact of running the full test suite on typical CI pipelines. - Compatibility guarantees across langchain-core versions when pinning is not used. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 2.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags langchain integration testing, chat model test fixtures, langchain test base classes, standard interface testing, integration test framework, langchain compliance tests, unit test templates, langchain-ecosystem, integration-testing, pytest-plugin [View on SkillFed](https://skillfed.io/packages/langchain-tests) · [View on PyPI](https://pypi.org/project/langchain-tests/)