Home / File/ conftest.py — langchain Source File

conftest.py — langchain Source File

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

File python CoreAbstractions Serialization 6 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  e7f28879_d9b0_59eb_c106_fe5bbec0e649["conftest.py"]
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  e7f28879_d9b0_59eb_c106_fe5bbec0e649 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  3888b2bf_bffe_7c16_770f_a406d400119c["importlib"]
  e7f28879_d9b0_59eb_c106_fe5bbec0e649 --> 3888b2bf_bffe_7c16_770f_a406d400119c
  8dfa0cac_d802_3ccd_f710_43a5e70da3a5["uuid"]
  e7f28879_d9b0_59eb_c106_fe5bbec0e649 --> 8dfa0cac_d802_3ccd_f710_43a5e70da3a5
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  e7f28879_d9b0_59eb_c106_fe5bbec0e649 --> 120e2591_3e15_b895_72b6_cb26195e40a6
  9eb3be64_a334_606b_b4bd_24e50a8c430d["blockbuster"]
  e7f28879_d9b0_59eb_c106_fe5bbec0e649 --> 9eb3be64_a334_606b_b4bd_24e50a8c430d
  2e073793_7bdb_2272_3b6f_82c878fdc38c["pytest_mock"]
  e7f28879_d9b0_59eb_c106_fe5bbec0e649 --> 2e073793_7bdb_2272_3b6f_82c878fdc38c
  style e7f28879_d9b0_59eb_c106_fe5bbec0e649 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Configuration for unit tests."""

from collections.abc import Iterator, Sequence
from importlib import util
from uuid import UUID

import pytest
from blockbuster import BlockBuster, blockbuster_ctx
from pytest_mock import MockerFixture


@pytest.fixture(autouse=True)
def blockbuster() -> Iterator[BlockBuster]:
    with blockbuster_ctx("langchain_core") as bb:
        for func in ["os.stat", "os.path.abspath"]:
            (
                bb.functions[func]
                .can_block_in("langchain_core/_api/internal.py", "is_caller_internal")
                .can_block_in("langchain_core/runnables/base.py", "__repr__")
                .can_block_in(
                    "langchain_core/beta/runnables/context.py", "aconfig_with_context"
                )
            )

        for func in ["os.stat", "io.TextIOWrapper.read"]:
            bb.functions[func].can_block_in(
                "langsmith/client.py", "_default_retry_config"
            )

        for bb_function in bb.functions.values():
            bb_function.can_block_in(
                "freezegun/api.py", "_get_cached_module_attributes"
            )

        yield bb


def pytest_addoption(parser: pytest.Parser) -> None:
    """Add custom command line options to pytest."""
    parser.addoption(
        "--only-extended",
        action="store_true",
        help="Only run extended tests. Does not allow skipping any extended tests.",
    )
    parser.addoption(
        "--only-core",
        action="store_true",
        help="Only run core tests. Never runs any extended tests.",
    )


def pytest_collection_modifyitems(
    config: pytest.Config, items: Sequence[pytest.Function]
) -> None:
    """Add implementations for handling custom markers.

    At the moment, this adds support for a custom `requires` marker.

    The `requires` marker is used to denote tests that require one or more packages
    to be installed to run. If the package is not installed, the test is skipped.
// ... (64 more lines)

Subdomains

Dependencies

  • blockbuster
  • collections.abc
  • importlib
  • pytest
  • pytest_mock
  • uuid

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, Serialization subdomain.
What functions are defined in conftest.py?
conftest.py defines 4 function(s): blockbuster, deterministic_uuids, pytest_addoption, pytest_collection_modifyitems.
What does conftest.py depend on?
conftest.py imports 6 module(s): blockbuster, collections.abc, importlib, pytest, pytest_mock, uuid.
Where is conftest.py in the architecture?
conftest.py is located at libs/core/tests/unit_tests/conftest.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/core/tests/unit_tests).

Analyze Your Own Codebase

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

Try Supermodel Free