From 4134b36db8c87788a9471ffddc5fda9bf1c6b35f Mon Sep 17 00:00:00 2001 From: Christophe Bornet Date: Mon, 7 Jul 2025 16:28:30 +0200 Subject: [PATCH] core: make ruff rule PLW1510 unfixable (#31868) See https://github.com/astral-sh/ruff/discussions/17087#discussioncomment-12675815 Tha autofix is misleading: it chooses to add `check=False` to keep the runtime behavior but in reality it hides the fact that most probably the user would prefer `check=True`. --- libs/core/pyproject.toml | 2 ++ libs/core/tests/benchmarks/test_imports.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.toml index 93ac1c0db7e..a7e3cb26252 100644 --- a/libs/core/pyproject.toml +++ b/libs/core/pyproject.toml @@ -103,6 +103,8 @@ ignore = [ "PLC0415", "PLR2004", ] +unfixable = ["PLW1510",] + flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel","langchain_core.load.serializable.Serializable","langchain_core.runnables.base.RunnableSerializable"] flake8-annotations.allow-star-arg-any = true flake8-annotations.mypy-init-return = true diff --git a/libs/core/tests/benchmarks/test_imports.py b/libs/core/tests/benchmarks/test_imports.py index f3b509f0241..f8a06a6b9f0 100644 --- a/libs/core/tests/benchmarks/test_imports.py +++ b/libs/core/tests/benchmarks/test_imports.py @@ -51,4 +51,4 @@ from pytest_benchmark.fixture import BenchmarkFixture # type: ignore[import-unt def test_import_time(benchmark: BenchmarkFixture, import_path: str) -> None: @benchmark # type: ignore[misc] def import_in_subprocess() -> None: - subprocess.run([sys.executable, "-c", import_path], check=False) + subprocess.run([sys.executable, "-c", import_path], check=True)