style: fix ruff formatting issues in conftest.py
- Fix import sorting and organization - Remove trailing whitespace - Add proper newline at end of file 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
"""Pytest configuration and fixtures for LEANN tests."""
|
"""Pytest configuration and fixtures for LEANN tests."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@@ -8,32 +9,33 @@ import pytest
|
|||||||
def test_environment():
|
def test_environment():
|
||||||
"""Set up test environment variables."""
|
"""Set up test environment variables."""
|
||||||
# Mark as test environment to skip memory-intensive operations
|
# Mark as test environment to skip memory-intensive operations
|
||||||
os.environ["CI"] = "true"
|
os.environ["CI"] = "true"
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session", autouse=True)
|
|
||||||
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
def cleanup_session():
|
def cleanup_session():
|
||||||
"""Session-level cleanup to ensure no hanging processes."""
|
"""Session-level cleanup to ensure no hanging processes."""
|
||||||
yield
|
yield
|
||||||
|
|
||||||
# Basic cleanup after all tests
|
# Basic cleanup after all tests
|
||||||
try:
|
try:
|
||||||
import psutil
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import psutil
|
||||||
|
|
||||||
current_process = psutil.Process(os.getpid())
|
current_process = psutil.Process(os.getpid())
|
||||||
children = current_process.children(recursive=True)
|
children = current_process.children(recursive=True)
|
||||||
|
|
||||||
for child in children:
|
for child in children:
|
||||||
try:
|
try:
|
||||||
child.terminate()
|
child.terminate()
|
||||||
except psutil.NoSuchProcess:
|
except psutil.NoSuchProcess:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Give them time to terminate gracefully
|
# Give them time to terminate gracefully
|
||||||
psutil.wait_procs(children, timeout=3)
|
psutil.wait_procs(children, timeout=3)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
# Don't fail tests due to cleanup errors
|
# Don't fail tests due to cleanup errors
|
||||||
pass
|
pass
|
||||||
Reference in New Issue
Block a user