tests: optimize test durations and refactor test fixtures (#3713)
* Refactor test fixtures and imports for optimization - Reordered and optimized imports in `conftest.py`. - Changed return statements to yield in `basic_graph` and `create_webhook` fixtures for better resource management. - Added cleanup step to `create_webhook` fixture to delete created webhook after test completion. * Refactor imports and add placeholder client fixture in test_ChatOllama_component.py * Add pytest fixture 'client' to test_graph.py * Add pytest fixture 'client' to test_callback_graph.py for test optimization * Add 'unit_tests_looponfail' target to Makefile for running unit tests with loop-on-fail option * Optimize test durations and update test cases in various modules
This commit is contained in:
parent
9b83f44611
commit
fcf780bf42
6 changed files with 516 additions and 304 deletions
|
|
@ -1,9 +1,16 @@
|
|||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
from langflow.components.models.OllamaModel import ChatOllamaComponent
|
||||
from langchain_community.chat_models.ollama import ChatOllama
|
||||
from unittest.mock import MagicMock, patch
|
||||
from urllib.parse import urljoin
|
||||
|
||||
import pytest
|
||||
from langchain_community.chat_models.ollama import ChatOllama
|
||||
|
||||
from langflow.components.models.OllamaModel import ChatOllamaComponent
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
pass
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def component():
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import asyncio
|
||||
|
||||
import pytest
|
||||
|
||||
from langflow.components.outputs.ChatOutput import ChatOutput
|
||||
from langflow.custom.custom_component.component import Component
|
||||
from langflow.events.event_manager import EventManager
|
||||
|
|
@ -9,6 +11,11 @@ from langflow.schema.message import Message
|
|||
from langflow.template.field.base import Output
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
pass
|
||||
|
||||
|
||||
class LogComponent(Component):
|
||||
name = "LogComponent"
|
||||
inputs = [IntInput(name="times", value=1)]
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ from langflow.utils.payload import get_root_vertex
|
|||
# BASIC_EXAMPLE_PATH, COMPLEX_EXAMPLE_PATH, OPENAPI_EXAMPLE_PATH
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
pass
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_template():
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue