test: add pyleak for task and event loop block detections (#8802)
* test: add pyleak for task and event loop block detections * test: add pyleak for task and event loop block detections * ci: add env variables for verbose logging * chore: dummy sleep to shwocase error * chore: dummy sleep to showcase error * chore: remove dummy sleep
This commit is contained in:
parent
7d44121691
commit
5734735e2d
10 changed files with 46 additions and 6 deletions
|
|
@ -3,7 +3,9 @@ from langflow.components.processing.parse_json_data import ParseJSONDataComponen
|
|||
from langflow.schema import Data
|
||||
|
||||
from tests.integration.components.mock_components import TextToData
|
||||
from tests.integration.utils import ComponentInputHandle, run_single_component
|
||||
from tests.integration.utils import ComponentInputHandle, pyleak_marker, run_single_component
|
||||
|
||||
pytestmark = pyleak_marker()
|
||||
|
||||
|
||||
async def test_from_data():
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ from langflow.components.input_output import ChatInput
|
|||
from langflow.memory import aget_messages
|
||||
from langflow.schema.message import Message
|
||||
|
||||
from tests.integration.utils import run_single_component
|
||||
from tests.integration.utils import pyleak_marker, run_single_component
|
||||
|
||||
pytestmark = pyleak_marker()
|
||||
|
||||
|
||||
async def test_default():
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
from langflow.components.input_output import TextInputComponent
|
||||
from langflow.schema.message import Message
|
||||
|
||||
from tests.integration.utils import run_single_component
|
||||
from tests.integration.utils import pyleak_marker, run_single_component
|
||||
|
||||
pytestmark = pyleak_marker()
|
||||
|
||||
|
||||
async def test_text_input():
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
from langflow.components.processing import PromptComponent
|
||||
from langflow.schema.message import Message
|
||||
|
||||
from tests.integration.utils import run_single_component
|
||||
from tests.integration.utils import pyleak_marker, run_single_component
|
||||
|
||||
pytestmark = pyleak_marker()
|
||||
|
||||
|
||||
async def test():
|
||||
|
|
|
|||
|
|
@ -4,3 +4,7 @@ import pytest
|
|||
@pytest.fixture(autouse=True)
|
||||
def _start_app(client):
|
||||
pass
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
config.addinivalue_line("markers", "no_leaks: detect asyncio task leaks, thread leaks, and event loop blocking")
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ from langflow.components.processing import PromptComponent
|
|||
from langflow.graph import Graph
|
||||
from langflow.schema.message import Message
|
||||
|
||||
from tests.integration.utils import run_flow
|
||||
from tests.integration.utils import pyleak_marker, run_flow
|
||||
|
||||
|
||||
@pyleak_marker()
|
||||
async def test_simple_no_llm():
|
||||
graph = Graph()
|
||||
flow_input = graph.add_component(ChatInput())
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import os
|
|||
import uuid
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
from astrapy.admin import parse_api_endpoint
|
||||
from langflow.api.v1.schemas import InputValueRequest
|
||||
|
|
@ -187,3 +188,11 @@ def build_component_instance_for_tests(version: str, module: str, file_name: str
|
|||
component = download_component_from_github(module, file_name, version)
|
||||
cc_class = eval_custom_component_code(component._code)
|
||||
return cc_class(**kwargs), component._code
|
||||
|
||||
|
||||
def pyleak_marker(**extra_args):
|
||||
default_args = {
|
||||
"enable_task_creation_tracking": True, # log task creation stacks
|
||||
"thread_name_filter": r"^(?!asyncio_\d+$).*", # exclude `asyncio_{num}` threads
|
||||
}
|
||||
return pytest.mark.no_leaks(**default_args, **extra_args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue