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.

File python LangChainCore ApiManagement 4 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  bb21a160_0e07_8247_2d86_89302488b86b["conftest.py"]
  feec1ec4_6917_867b_d228_b134d0ff8099["typing"]
  bb21a160_0e07_8247_2d86_89302488b86b --> feec1ec4_6917_867b_d228_b134d0ff8099
  f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"]
  bb21a160_0e07_8247_2d86_89302488b86b --> f69d6389_263d_68a4_7fbf_f14c0602a9ba
  bdea426b_c015_51c9_1f10_8ea43c906da7["langchain_tests.conftest"]
  bb21a160_0e07_8247_2d86_89302488b86b --> bdea426b_c015_51c9_1f10_8ea43c906da7
  fd730e0b_ca89_147d_fac4_36547b01ebaf["vcr"]
  bb21a160_0e07_8247_2d86_89302488b86b --> fd730e0b_ca89_147d_fac4_36547b01ebaf
  style bb21a160_0e07_8247_2d86_89302488b86b 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())

Domain

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 LangChainCore domain, ApiManagement 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/groq/tests/conftest.py (domain: LangChainCore, subdomain: ApiManagement, directory: libs/partners/groq/tests).

Analyze Your Own Codebase

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

Try Supermodel Free