Home / File/ conftest.py — langchain Source File

conftest.py — langchain Source File

Architecture documentation for conftest.py, a python file in the langchain codebase. 4 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  2afb3985_187d_43eb_1c57_ecaf966eae63["conftest.py"]
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  2afb3985_187d_43eb_1c57_ecaf966eae63 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  2afb3985_187d_43eb_1c57_ecaf966eae63 --> 120e2591_3e15_b895_72b6_cb26195e40a6
  42a409ea_9676_f019_a076_246c8c01ecae["langchain_tests.conftest"]
  2afb3985_187d_43eb_1c57_ecaf966eae63 --> 42a409ea_9676_f019_a076_246c8c01ecae
  be04c44e_b094_7140_6a6a_3ec8bbd56d69["vcr"]
  2afb3985_187d_43eb_1c57_ecaf966eae63 --> be04c44e_b094_7140_6a6a_3ec8bbd56d69
  style 2afb3985_187d_43eb_1c57_ecaf966eae63 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import Any

import pytest
from langchain_tests.conftest import CustomPersister, CustomSerializer, base_vcr_config
from vcr import VCR  # type: ignore[import-untyped]


def remove_request_headers(request: Any) -> Any:
    for k in request.headers:
        request.headers[k] = "**REDACTED**"
    return request


def remove_response_headers(response: dict) -> dict:
    for k in response["headers"]:
        response["headers"][k] = "**REDACTED**"
    return response


@pytest.fixture(scope="session")
def vcr_config() -> dict:
    """Extend the default configuration coming from langchain_tests."""
    config = base_vcr_config()
    config["before_record_request"] = remove_request_headers
    config["before_record_response"] = remove_response_headers
    config["serializer"] = "yaml.gz"
    config["path_transformer"] = VCR.ensure_suffix(".yaml.gz")

    return config


def pytest_recording_configure(config: dict, vcr: VCR) -> None:
    vcr.register_persister(CustomPersister())
    vcr.register_serializer("yaml.gz", CustomSerializer())

Subdomains

Dependencies

  • langchain_tests.conftest
  • pytest
  • typing
  • vcr

Frequently Asked Questions

What does conftest.py do?
conftest.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in conftest.py?
conftest.py defines 4 function(s): pytest_recording_configure, remove_request_headers, remove_response_headers, vcr_config.
What does conftest.py depend on?
conftest.py imports 4 module(s): langchain_tests.conftest, pytest, typing, vcr.
Where is conftest.py in the architecture?
conftest.py is located at libs/partners/anthropic/tests/conftest.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/partners/anthropic/tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free