ref: Add ruff rules for bugbear (B) (#3983)

Add ruff rules for bugbear (B)
This commit is contained in:
Christophe Bornet 2024-10-02 18:55:51 +02:00 • committed by GitHub
commit 7e3d470845
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
86 changed files with 267 additions and 230 deletions

View file

@ -11,6 +11,9 @@ from typing import TYPE_CHECKING
import orjson
import pytest
from loguru import logger
from pytest import LogCaptureFixture
from base.langflow.components.inputs.ChatInput import ChatInput
from dotenv import load_dotenv
from fastapi.testclient import TestClient
@ -79,6 +82,19 @@ def get_text():
assert path.exists(), f"File {path} does not exist. Available files: {list(data_path.iterdir())}"
@pytest.fixture
def caplog(caplog: LogCaptureFixture):
handler_id = logger.add(
caplog.handler,
format="{message}",
level=0,
filter=lambda record: record["level"].no >= caplog.handler.level,
enqueue=False, # Set to 'True' if your test is spawning child processes.
)
yield caplog
logger.remove(handler_id)
@pytest.fixture()
async def async_client() -> AsyncGenerator:
from langflow.main import create_app