Setup
먼저 필요한 dependency를 설치합니다:langchain-core
custom component를 정의하기 위해 import할 interface를 정의합니다
langchain-tests
standard test와 이를 실행하는 데 필요한
pytest plugin을 제공합니다새 버전의
langchain-tests에 추가된 test가 CI/CD pipeline을 중단시킬 수 있으므로, 예상치 못한 변경을 방지하기 위해 langchain-tests의 최신 버전으로 고정하는 것을 권장합니다.langchain-tests package에는 2개의 namespace가 있습니다:
Unit tests
Unit tests
Integration tests
Integration tests
위치:
langchain_tests.integration_tests외부 서비스(특히 component가 상호작용하도록 설계된 외부 서비스)에 접근하여 component를 테스트하도록 설계되었습니다API reference 보기pytest class 기반 test suite로 구현됩니다.
Standard test 구현하기
통합 유형에 따라 unit test, integration test 중 하나 또는 둘 다를 구현해야 합니다. 통합 유형에 대한 standard test suite를 subclass화하면 해당 유형에 대한 전체 standard test 모음을 얻을 수 있습니다. test 실행이 성공하려면, 주어진 test는 model이 테스트되는 기능을 지원하는 경우에만 통과해야 합니다. 그렇지 않으면 test를 건너뛰어야 합니다. 서로 다른 통합은 고유한 기능 세트를 제공하므로, LangChain이 제공하는 대부분의 standard test는 false positive를 방지하기 위해 기본적으로 opt-in입니다. 따라서 통합이 지원하는 기능을 나타내기 위해 property를 override해야 합니다 - 예시는 아래를 참조하세요.tests/integration_tests/test_standard.py
package의 root를 기준으로 다음 하위 디렉토리에 test를 구성해야 합니다:
- unit test의 경우
tests/unit_tests - integration test의 경우
tests/integration_tests
- Unit tests
- Integration tests
Test 실행하기
template에서 통합을 bootstrap하는 경우, unit test와 integration test를 실행하기 위한 target이 포함된Makefile이 제공됩니다:
문제 해결
사용 가능한 standard test suite의 전체 목록과 포함된 test에 대한 정보 및 일반적인 문제 해결 방법은 Standard Tests API Reference를 참조하세요.Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.