style: fix code formatting and linting issues

- Fix whitespace in docstrings and blank lines
- Remove unused variables in tests
- Rename unused loop variables to follow conventions
- All ruff checks now pass

Signed-off-by: Hal <hal.long@outlook.com>
This commit is contained in:
longhao 2025-05-27 18:58:25 +08:00 committed by Hal
parent 6b14ff6da5
commit f2b92ff0ee
6 changed files with 196 additions and 205 deletions

View file

@ -1,10 +1,14 @@
"""Tests for dependency resolver functionality."""
import pytest
from unittest.mock import AsyncMock, patch
from pypi_query_mcp.tools.dependency_resolver import DependencyResolver, resolve_package_dependencies
import pytest
from pypi_query_mcp.core.exceptions import InvalidPackageNameError, PackageNotFoundError
from pypi_query_mcp.tools.dependency_resolver import (
DependencyResolver,
resolve_package_dependencies,
)
class TestDependencyResolver:
@ -71,7 +75,7 @@ class TestDependencyResolver:
mock_client.get_package_info.return_value = mock_package_data
result = await resolver.resolve_dependencies(
"test-package",
"test-package",
python_version="3.11"
)

View file

@ -1,13 +1,16 @@
"""Tests for package downloader functionality."""
import pytest
from pathlib import Path
from unittest.mock import AsyncMock, patch, mock_open
import tempfile
import shutil
import tempfile
from unittest.mock import AsyncMock, mock_open, patch
from pypi_query_mcp.tools.package_downloader import PackageDownloader, download_package_with_dependencies
from pypi_query_mcp.core.exceptions import InvalidPackageNameError, PackageNotFoundError
import pytest
from pypi_query_mcp.core.exceptions import InvalidPackageNameError
from pypi_query_mcp.tools.package_downloader import (
PackageDownloader,
download_package_with_dependencies,
)
class TestPackageDownloader:
@ -218,25 +221,6 @@ class TestPackageDownloader:
@pytest.mark.asyncio
async def test_download_package_with_dependencies_function(self, temp_download_dir):
"""Test the standalone download_package_with_dependencies function."""
mock_package_data = {
"info": {
"name": "test-package",
"version": "1.0.0",
"requires_python": ">=3.8",
"requires_dist": []
},
"releases": {
"1.0.0": [
{
"filename": "test_package-1.0.0-py3-none-any.whl",
"url": "https://files.pythonhosted.org/packages/test_package-1.0.0-py3-none-any.whl",
"packagetype": "bdist_wheel",
"md5_digest": "abc123",
"size": 1024
}
]
}
}
with patch('pypi_query_mcp.tools.package_downloader.PackageDownloader') as mock_downloader_class:
# Setup downloader mock