ref: Remove autouse from pytest client fixture (#4158)
Remove autouse from pytest client fixture
This commit is contained in:
parent
2be7c56939
commit
047077cee4
41 changed files with 17 additions and 190 deletions
|
|
@ -273,7 +273,7 @@ def json_memory_chatbot_no_llm():
|
||||||
return pytest.MEMORY_CHATBOT_NO_LLM.read_text()
|
return pytest.MEMORY_CHATBOT_NO_LLM.read_text()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="client", autouse=True)
|
@pytest.fixture(name="client")
|
||||||
async def client_fixture(session: Session, monkeypatch, request, load_flows_dir):
|
async def client_fixture(session: Session, monkeypatch, request, load_flows_dir):
|
||||||
# Set the database url to a test database
|
# Set the database url to a test database
|
||||||
if "noclient" in request.keywords:
|
if "noclient" in request.keywords:
|
||||||
|
|
|
||||||
6
src/backend/tests/integration/conftest.py
Normal file
6
src/backend/tests/integration/conftest.py
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def _start_app(client):
|
||||||
|
pass
|
||||||
|
|
@ -12,11 +12,6 @@ from langflow.schema.message import Message
|
||||||
from langflow.services.settings.feature_flags import FEATURE_FLAGS
|
from langflow.services.settings.feature_flags import FEATURE_FLAGS
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def add_toolkit_output():
|
def add_toolkit_output():
|
||||||
FEATURE_FLAGS.add_toolkit_output = True
|
FEATURE_FLAGS.add_toolkit_output = True
|
||||||
|
|
@ -87,7 +82,7 @@ def test_component_tool():
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.api_key_required
|
@pytest.mark.api_key_required
|
||||||
@pytest.mark.usefixtures("add_toolkit_output")
|
@pytest.mark.usefixtures("add_toolkit_output", "client")
|
||||||
def test_component_tool_with_api_key():
|
def test_component_tool_with_api_key():
|
||||||
chat_output = ChatOutput()
|
chat_output = ChatOutput()
|
||||||
openai_llm = OpenAIModelComponent()
|
openai_llm = OpenAIModelComponent()
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,6 @@ from langchain_community.chat_models.ollama import ChatOllama
|
||||||
from langflow.components.models.OllamaModel import ChatOllamaComponent
|
from langflow.components.models.OllamaModel import ChatOllamaComponent
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def component():
|
def component():
|
||||||
return ChatOllamaComponent()
|
return ChatOllamaComponent()
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,6 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
from langflow.components.prompts.Prompt import PromptComponent # type: ignore
|
from langflow.components.prompts.Prompt import PromptComponent # type: ignore
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class TestPromptComponent:
|
class TestPromptComponent:
|
||||||
def test_post_code_processing(self):
|
def test_post_code_processing(self):
|
||||||
component = PromptComponent(template="Hello {name}!", name="John")
|
component = PromptComponent(template="Hello {name}!", name="John")
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
from langflow.components.tools.PythonREPLTool import PythonREPLToolComponent
|
from langflow.components.tools.PythonREPLTool import PythonREPLToolComponent
|
||||||
from langflow.custom.custom_component.component import Component
|
from langflow.custom.custom_component.component import Component
|
||||||
from langflow.custom.utils import build_custom_component_template
|
from langflow.custom.utils import build_custom_component_template
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_python_repl_tool_template():
|
def test_python_repl_tool_template():
|
||||||
python_repl_tool = PythonREPLToolComponent()
|
python_repl_tool = PythonREPLToolComponent()
|
||||||
component = Component(_code=python_repl_tool._code)
|
component = Component(_code=python_repl_tool._code)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
from langflow.components.tools.YfinanceTool import YfinanceToolComponent
|
from langflow.components.tools.YfinanceTool import YfinanceToolComponent
|
||||||
from langflow.custom.custom_component.component import Component
|
from langflow.custom.custom_component.component import Component
|
||||||
from langflow.custom.utils import build_custom_component_template
|
from langflow.custom.utils import build_custom_component_template
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_yfinance_tool_template():
|
def test_yfinance_tool_template():
|
||||||
yf_tool = YfinanceToolComponent()
|
yf_tool = YfinanceToolComponent()
|
||||||
component = Component(_code=yf_tool._code)
|
component = Component(_code=yf_tool._code)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from langflow.components.inputs.ChatInput import ChatInput
|
from langflow.components.inputs.ChatInput import ChatInput
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_component_to_toolkit():
|
def test_component_to_toolkit():
|
||||||
chat_input = ChatInput()
|
chat_input = ChatInput()
|
||||||
tools = chat_input.to_toolkit()
|
tools = chat_input.to_toolkit()
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,6 @@ from langflow.components.outputs import ChatOutput
|
||||||
from langflow.template.field.base import Output
|
from langflow.template.field.base import Output
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_set_invalid_output():
|
def test_set_invalid_output():
|
||||||
chatinput = ChatInput()
|
chatinput = ChatInput()
|
||||||
chatoutput = ChatOutput()
|
chatoutput = ChatOutput()
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,6 @@ from langflow.events.event_manager import EventManager
|
||||||
from langflow.schema.log import LoggableType
|
from langflow.schema.log import LoggableType
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class TestEventManager:
|
class TestEventManager:
|
||||||
# Registering an event with a valid name and callback using a mock callback function
|
# Registering an event with a valid name and callback using a mock callback function
|
||||||
def test_register_event_with_valid_name_and_callback_with_mock_callback(self):
|
def test_register_event_with_valid_name_and_callback_with_mock_callback(self):
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,7 @@ from langflow.components.prompts.Prompt import PromptComponent
|
||||||
from langflow.graph.graph.base import Graph
|
from langflow.graph.graph.base import Graph
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.mark.usefixtures("client")
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_edge_raises_error_on_invalid_target_handle():
|
def test_edge_raises_error_on_invalid_target_handle():
|
||||||
template = """Answer the user as if you were a pirate.
|
template = """Answer the user as if you were a pirate.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,6 @@ from langflow.graph.state.model import create_state_model
|
||||||
from langflow.template.field.base import UNDEFINED
|
from langflow.template.field.base import UNDEFINED
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def chat_input_component():
|
def chat_input_component():
|
||||||
return ChatInput()
|
return ChatInput()
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,6 @@ from langflow.graph.graph.base import Graph
|
||||||
from langflow.graph.graph.constants import Finish
|
from langflow.graph.graph.constants import Finish
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_graph_not_prepared():
|
async def test_graph_not_prepared():
|
||||||
chat_input = ChatInput()
|
chat_input = ChatInput()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from langflow.components.outputs.ChatOutput import ChatOutput
|
from langflow.components.outputs.ChatOutput import ChatOutput
|
||||||
from langflow.custom.custom_component.component import Component
|
from langflow.custom.custom_component.component import Component
|
||||||
|
|
@ -11,11 +10,6 @@ from langflow.schema.message import Message
|
||||||
from langflow.template.field.base import Output
|
from langflow.template.field.base import Output
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class LogComponent(Component):
|
class LogComponent(Component):
|
||||||
name = "LogComponent"
|
name = "LogComponent"
|
||||||
inputs = [IntInput(name="times", value=1)]
|
inputs = [IntInput(name="times", value=1)]
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,6 @@ from langflow.io import MessageTextInput, Output
|
||||||
from langflow.schema.message import Message
|
from langflow.schema.message import Message
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class Concatenate(Component):
|
class Concatenate(Component):
|
||||||
display_name = "Concatenate"
|
display_name = "Concatenate"
|
||||||
description = "Concatenates two strings"
|
description = "Concatenates two strings"
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,6 @@ from langflow.graph.graph.constants import Finish
|
||||||
from langflow.graph.graph.state_model import create_state_model_from_graph
|
from langflow.graph.graph.state_model import create_state_model_from_graph
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_graph_state_model():
|
def test_graph_state_model():
|
||||||
session_id = "test_session_id"
|
session_id = "test_session_id"
|
||||||
template = """{context}
|
template = """{context}
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,6 @@ import pytest
|
||||||
from langflow.graph.graph.runnable_vertices_manager import RunnableVerticesManager
|
from langflow.graph.graph.runnable_vertices_manager import RunnableVerticesManager
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def data():
|
def data():
|
||||||
run_map: defaultdict(list) = {"A": ["B", "C"], "B": ["D"], "C": ["D"], "D": []}
|
run_map: defaultdict(list) = {"A": ["B", "C"], "B": ["D"], "C": ["D"], "D": []}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ import pytest
|
||||||
from langflow.graph.graph import utils
|
from langflow.graph.graph import utils
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def graph():
|
def graph():
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,6 @@ from langflow.initial_setup.setup import load_starter_projects
|
||||||
# BASIC_EXAMPLE_PATH, COMPLEX_EXAMPLE_PATH, OPENAPI_EXAMPLE_PATH
|
# BASIC_EXAMPLE_PATH, COMPLEX_EXAMPLE_PATH, OPENAPI_EXAMPLE_PATH
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sample_template():
|
def sample_template():
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,6 @@ from langflow.graph.graph.constants import Finish
|
||||||
from langflow.schema.data import Data
|
from langflow.schema.data import Data
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def ingestion_graph():
|
def ingestion_graph():
|
||||||
# Ingestion Graph
|
# Ingestion Graph
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,6 @@ from langflow.inputs.utils import instantiate_input
|
||||||
from langflow.schema.message import Message
|
from langflow.schema.message import Message
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_table_input_valid():
|
def test_table_input_valid():
|
||||||
data = TableInput(name="valid_table", value=[{"key": "value"}, {"key2": "value2"}])
|
data = TableInput(name="valid_table", value=[{"key": "value"}, {"key2": "value2"}])
|
||||||
assert data.value == [{"key": "value"}, {"key2": "value2"}]
|
assert data.value == [{"key": "value"}, {"key2": "value2"}]
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,6 @@ from pydantic.fields import FieldInfo
|
||||||
from langflow.components.inputs.ChatInput import ChatInput
|
from langflow.components.inputs.ChatInput import ChatInput
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_input_schema():
|
def test_create_input_schema():
|
||||||
from langflow.io.schema import create_input_schema
|
from langflow.io.schema import create_input_schema
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ import pytest
|
||||||
from langflow.schema.table import Column, FormatterType
|
from langflow.schema.table import Column, FormatterType
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class TestColumn:
|
class TestColumn:
|
||||||
# Creating a Column instance without display_name sets it to the name
|
# Creating a Column instance without display_name sets it to the name
|
||||||
def test_create_column_without_display_name(self):
|
def test_create_column_without_display_name(self):
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,6 @@ from langchain_core.prompts.chat import ChatPromptTemplate
|
||||||
from langflow.schema.message import Message
|
from langflow.schema.message import Message
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_message_async_prompt_serialization():
|
async def test_message_async_prompt_serialization():
|
||||||
template = "Hello, {name}!"
|
template = "Hello, {name}!"
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,6 @@ from langflow.services.variable.constants import CREDENTIAL_TYPE, GENERIC_TYPE
|
||||||
from langflow.services.variable.service import DatabaseVariableService
|
from langflow.services.variable.service import DatabaseVariableService
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def service():
|
def service():
|
||||||
settings_service = get_settings_service()
|
settings_service = get_settings_service()
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ def default_settings():
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("client")
|
||||||
def test_components_path(runner, default_settings, tmp_path):
|
def test_components_path(runner, default_settings, tmp_path):
|
||||||
# create a "components" folder
|
# create a "components" folder
|
||||||
temp_dir = tmp_path / "components"
|
temp_dir = tmp_path / "components"
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,6 @@ from langflow.custom.custom_component.base_component import BaseComponent, Compo
|
||||||
from langflow.custom.utils import build_custom_component_template
|
from langflow.custom.utils import build_custom_component_template
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def code_component_with_multiple_outputs():
|
def code_component_with_multiple_outputs():
|
||||||
code = Path("src/backend/tests/data/component_multiple_outputs.py").read_text()
|
code = Path("src/backend/tests/data/component_multiple_outputs.py").read_text()
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,6 @@ from langchain_core.documents import Document
|
||||||
from langflow.schema import Data
|
from langflow.schema import Data
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_data_initialization():
|
def test_data_initialization():
|
||||||
record = Data(text_key="msg", data={"msg": "Hello, World!", "extra": "value"})
|
record = Data(text_key="msg", data={"msg": "Hello, World!", "extra": "value"})
|
||||||
assert record.msg == "Hello, World!"
|
assert record.msg == "Hello, World!"
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,6 @@ from httpx import Response
|
||||||
from langflow.components import data
|
from langflow.components import data
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def api_request():
|
def api_request():
|
||||||
# This fixture provides an instance of APIRequest for each test case
|
# This fixture provides an instance of APIRequest for each test case
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,4 @@
|
||||||
from langflow.components import prototypes
|
from langflow.components import prototypes
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_python_function_component():
|
def test_python_function_component():
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ from langflow.template.frontend_node.base import FrontendNode
|
||||||
from langflow.template.template.base import Template
|
from langflow.template.template.base import Template
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sample_template_field() -> Input:
|
def sample_template_field() -> Input:
|
||||||
return Input(name="test_field", field_type="str")
|
return Input(name="test_field", field_type="str")
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,6 @@ from langflow.components import helpers
|
||||||
from langflow.custom.utils import build_custom_component_template
|
from langflow.custom.utils import build_custom_component_template
|
||||||
from langflow.schema import Data
|
from langflow.schema import Data
|
||||||
from langflow.schema.message import Message
|
from langflow.schema.message import Message
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# def test_update_data_component():
|
# def test_update_data_component():
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ def test_get_project_data():
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
@pytest.mark.usefixtures("client")
|
||||||
async def test_create_or_update_starter_projects():
|
async def test_create_or_update_starter_projects():
|
||||||
with session_scope() as session:
|
with session_scope() as session:
|
||||||
# Get the number of projects returned by load_starter_projects
|
# Get the number of projects returned by load_starter_projects
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
from langflow.graph import Graph
|
from langflow.graph import Graph
|
||||||
from langflow.initial_setup.setup import load_starter_projects
|
from langflow.initial_setup.setup import load_starter_projects
|
||||||
from langflow.load import load_flow_from_json
|
from langflow.load import load_flow_from_json
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: UPDATE BASIC EXAMPLE
|
# TODO: UPDATE BASIC EXAMPLE
|
||||||
# def test_load_flow_from_json():
|
# def test_load_flow_from_json():
|
||||||
# """Test loading a flow from a json file"""
|
# """Test loading a flow from a json file"""
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ from unittest.mock import patch
|
||||||
from langflow.logging.logger import SizedLogBuffer
|
from langflow.logging.logger import SizedLogBuffer
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sized_log_buffer():
|
def sized_log_buffer():
|
||||||
return SizedLogBuffer()
|
return SizedLogBuffer()
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ def created_messages(session):
|
||||||
return messages_read
|
return messages_read
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("client")
|
||||||
def test_get_messages():
|
def test_get_messages():
|
||||||
add_messages(
|
add_messages(
|
||||||
[
|
[
|
||||||
|
|
@ -49,6 +50,7 @@ def test_get_messages():
|
||||||
assert messages[1].text == "Test message 2"
|
assert messages[1].text == "Test message 2"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("client")
|
||||||
def test_add_messages():
|
def test_add_messages():
|
||||||
message = Message(text="New Test message", sender="User", sender_name="User", session_id="new_session_id")
|
message = Message(text="New Test message", sender="User", sender_name="User", session_id="new_session_id")
|
||||||
messages = add_messages(message)
|
messages = add_messages(message)
|
||||||
|
|
@ -56,6 +58,7 @@ def test_add_messages():
|
||||||
assert messages[0].text == "New Test message"
|
assert messages[0].text == "New Test message"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("client")
|
||||||
def test_add_messagetables(session):
|
def test_add_messagetables(session):
|
||||||
messages = [MessageTable(text="New Test message", sender="User", sender_name="User", session_id="new_session_id")]
|
messages = [MessageTable(text="New Test message", sender="User", sender_name="User", session_id="new_session_id")]
|
||||||
added_messages = add_messagetables(messages, session)
|
added_messages = add_messagetables(messages, session)
|
||||||
|
|
@ -63,6 +66,7 @@ def test_add_messagetables(session):
|
||||||
assert added_messages[0].text == "New Test message"
|
assert added_messages[0].text == "New Test message"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("client")
|
||||||
def test_delete_messages(session):
|
def test_delete_messages(session):
|
||||||
session_id = "session_id2"
|
session_id = "session_id2"
|
||||||
delete_messages(session_id)
|
delete_messages(session_id)
|
||||||
|
|
@ -70,6 +74,7 @@ def test_delete_messages(session):
|
||||||
assert len(messages) == 0
|
assert len(messages) == 0
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("client")
|
||||||
def test_store_message():
|
def test_store_message():
|
||||||
message = Message(text="Stored message", sender="User", sender_name="User", session_id="stored_session_id")
|
message = Message(text="Stored message", sender="User", sender_name="User", session_id="stored_session_id")
|
||||||
stored_messages = store_message(message)
|
stored_messages = store_message(message)
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,6 @@ from langflow.type_extraction.type_extraction import post_process_type
|
||||||
from collections.abc import Sequence as SequenceABC
|
from collections.abc import Sequence as SequenceABC
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="client", autouse=True)
|
|
||||||
def client_fixture():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class TestInput:
|
class TestInput:
|
||||||
def test_field_type_str(self):
|
def test_field_type_str(self):
|
||||||
input_obj = Input(field_type="str")
|
input_obj = Input(field_type="str")
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ from langflow.utils.util import build_template_from_function, get_base_classes,
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# Dummy classes for testing purposes
|
# Dummy classes for testing purposes
|
||||||
class Parent(BaseModel):
|
class Parent(BaseModel):
|
||||||
"""Parent Class"""
|
"""Parent Class"""
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ async def super_user_headers(client: AsyncClient, super_user):
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def deactivated_user():
|
def deactivated_user(client):
|
||||||
with session_getter(get_db_service()) as session:
|
with session_getter(get_db_service()) as session:
|
||||||
user = User(
|
user = User(
|
||||||
username="deactivateduser",
|
username="deactivateduser",
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,6 @@ from requests.exceptions import MissingSchema
|
||||||
from langflow.utils.validate import create_function, execute_function, extract_function_name, validate_code
|
from langflow.utils.validate import create_function, execute_function, extract_function_name, validate_code
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_function():
|
def test_create_function():
|
||||||
code = """
|
code = """
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,6 @@ import pytest
|
||||||
from langflow.utils.connection_string_parser import transform_connection_string
|
from langflow.utils.connection_string_parser import transform_connection_string
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"connection_string, expected",
|
"connection_string, expected",
|
||||||
[
|
[
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue