From 854dbe16cf2c31380232784dab67b8c35722b198 Mon Sep 17 00:00:00 2001 From: Fahad Date: Mon, 9 Jun 2025 14:02:13 +0400 Subject: [PATCH] fix: resolve E402 linting errors in conftest.py - Move all imports to top of file including asyncio, tempfile, and pytest - Maintain functionality while following proper import order - All linting checks now pass --- tests/conftest.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index ca11627..2685302 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,10 +2,14 @@ Pytest configuration for Gemini MCP Server tests """ +import asyncio import os import sys +import tempfile from pathlib import Path +import pytest + # Ensure the parent directory is in the Python path for imports parent_dir = Path(__file__).resolve().parent.parent if str(parent_dir) not in sys.path: @@ -17,23 +21,15 @@ if "GEMINI_API_KEY" not in os.environ: # Set MCP_PROJECT_ROOT to a temporary directory for tests # This provides a safe sandbox for file operations during testing -import tempfile - # Create a temporary directory that will be used as the project root for all tests test_root = tempfile.mkdtemp(prefix="gemini_mcp_test_") os.environ["MCP_PROJECT_ROOT"] = test_root # Configure asyncio for Windows compatibility if sys.platform == "win32": - import asyncio - asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) -# Pytest fixtures -import pytest - - @pytest.fixture def project_path(tmp_path): """