Home / File/ conftest.py — langchain Source File

conftest.py — langchain Source File

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

Entity Profile

Dependency Diagram

graph LR
  07f08dda_949f_1db4_29eb_27cca9d8951d["conftest.py"]
  b6ee5de5_719a_eeb5_1e11_e9c63bc22ef8["pathlib"]
  07f08dda_949f_1db4_29eb_27cca9d8951d --> b6ee5de5_719a_eeb5_1e11_e9c63bc22ef8
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  07f08dda_949f_1db4_29eb_27cca9d8951d --> 120e2591_3e15_b895_72b6_cb26195e40a6
  c57751d7_49cf_b819_2617_2a0c17891041["dotenv"]
  07f08dda_949f_1db4_29eb_27cca9d8951d --> c57751d7_49cf_b819_2617_2a0c17891041
  style 07f08dda_949f_1db4_29eb_27cca9d8951d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from pathlib import Path

import pytest

# Getting the absolute path of the current file's directory
ABS_PATH = Path(__file__).resolve().parent

# Getting the absolute path of the project's root directory
PROJECT_DIR = ABS_PATH.parent.parent


# Loading the .env file if it exists
def _load_env() -> None:
    dotenv_path = PROJECT_DIR / "tests" / "integration_tests" / ".env"
    if dotenv_path.exists():
        from dotenv import load_dotenv

        load_dotenv(dotenv_path)


_load_env()


@pytest.fixture(scope="module")
def test_dir() -> Path:
    return PROJECT_DIR / "tests" / "integration_tests"


# This fixture returns a string containing the path to the cassette directory for the
# current module
@pytest.fixture(scope="module")
def vcr_cassette_dir(request: pytest.FixtureRequest) -> str:
    module = Path(request.module.__file__)
    return str(module.parent / "cassettes" / module.stem)

Subdomains

Dependencies

  • dotenv
  • pathlib
  • pytest

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 3 function(s): _load_env, test_dir, vcr_cassette_dir.
What does conftest.py depend on?
conftest.py imports 3 module(s): dotenv, pathlib, pytest.
Where is conftest.py in the architecture?
conftest.py is located at libs/langchain/tests/integration_tests/conftest.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/langchain/tests/integration_tests).

Analyze Your Own Codebase

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

Try Supermodel Free