Add pre-commit to pytest dependencies and format test code

• Add pre-commit to pytest extra deps
• Update lock file dependencies
This commit is contained in:
yangdx 2025-11-18 00:42:04 +08:00
parent 99262adaaa
commit 5da82bb096
3 changed files with 6 additions and 0 deletions

View file

@ -46,6 +46,7 @@ dependencies = [
pytest = [ pytest = [
"pytest>=8.4.2", "pytest>=8.4.2",
"pytest-asyncio>=1.2.0", "pytest-asyncio>=1.2.0",
"pre-commit",
] ]
api = [ api = [

View file

@ -824,6 +824,7 @@ async def test_lightrag_end_to_end_workspace_isolation():
# Factory function to create different mock LLM functions for each workspace # Factory function to create different mock LLM functions for each workspace
def create_mock_llm_func(workspace_name): def create_mock_llm_func(workspace_name):
"""Create a mock LLM function that returns different content based on workspace""" """Create a mock LLM function that returns different content based on workspace"""
async def mock_llm_func( async def mock_llm_func(
prompt, system_prompt=None, history_messages=[], **kwargs prompt, system_prompt=None, history_messages=[], **kwargs
) -> str: ) -> str:
@ -840,6 +841,7 @@ relation<|#|>Machine Learning<|#|>Artificial Intelligence<|#|>subset, related fi
entity<|#|>Neural Networks<|#|>concept<|#|>Neural Networks are computing systems inspired by biological neural networks. entity<|#|>Neural Networks<|#|>concept<|#|>Neural Networks are computing systems inspired by biological neural networks.
relation<|#|>Deep Learning<|#|>Neural Networks<|#|>uses, composed of<|#|>Deep Learning uses multiple layers of Neural Networks to learn representations. relation<|#|>Deep Learning<|#|>Neural Networks<|#|>uses, composed of<|#|>Deep Learning uses multiple layers of Neural Networks to learn representations.
<|COMPLETE|>""" <|COMPLETE|>"""
return mock_llm_func return mock_llm_func
# Mock embedding function # Mock embedding function

3
uv.lock generated
View file

@ -2611,6 +2611,7 @@ docling = [
evaluation = [ evaluation = [
{ name = "datasets" }, { name = "datasets" },
{ name = "httpx" }, { name = "httpx" },
{ name = "pre-commit" },
{ name = "pytest" }, { name = "pytest" },
{ name = "pytest-asyncio" }, { name = "pytest-asyncio" },
{ name = "ragas" }, { name = "ragas" },
@ -2696,6 +2697,7 @@ offline-storage = [
{ name = "redis" }, { name = "redis" },
] ]
pytest = [ pytest = [
{ name = "pre-commit" },
{ name = "pytest" }, { name = "pytest" },
{ name = "pytest-asyncio" }, { name = "pytest-asyncio" },
] ]
@ -2751,6 +2753,7 @@ requires-dist = [
{ name = "passlib", extras = ["bcrypt"], marker = "extra == 'api'" }, { name = "passlib", extras = ["bcrypt"], marker = "extra == 'api'" },
{ name = "pipmaster" }, { name = "pipmaster" },
{ name = "pipmaster", marker = "extra == 'api'" }, { name = "pipmaster", marker = "extra == 'api'" },
{ name = "pre-commit", marker = "extra == 'pytest'" },
{ name = "psutil", marker = "extra == 'api'" }, { name = "psutil", marker = "extra == 'api'" },
{ name = "pycryptodome", marker = "extra == 'api'", specifier = ">=3.0.0,<4.0.0" }, { name = "pycryptodome", marker = "extra == 'api'", specifier = ">=3.0.0,<4.0.0" },
{ name = "pydantic" }, { name = "pydantic" },