Skip to content

Commit 141aa0a

Browse files
committed
fix: resolve comments
1 parent 2f4d538 commit 141aa0a

File tree

7 files changed

+13
-43
lines changed

7 files changed

+13
-43
lines changed

packages/qdrant-loader-mcp-server/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dependencies = [
4141
"click>=8.0.0",
4242
"tomli>=2.0.0",
4343
"networkx>=3.0.0",
44-
"qdrant-loader-core[openai]==0.7.3",
44+
"qdrant-loader-core==0.7.3",
4545
]
4646

4747
classifiers = [

packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/search/hybrid/components/builder.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,8 @@ def _create_llm_provider_from_env(logger: Any | None = None) -> Any | None:
3030
if isinstance(maybe_llm, dict) and maybe_llm:
3131
# Make a shallow copy so we can safely overlay defaults/env
3232
llm_cfg = dict(maybe_llm)
33-
except Exception as cfg_err:
33+
except Exception:
3434
# Non-fatal: fall through to env-only defaults
35-
if logger is not None:
36-
try:
37-
logger.debug(
38-
"Failed to load config file, using env-only mode",
39-
error=str(cfg_err),
40-
)
41-
except Exception:
42-
pass
4335
llm_cfg = None
4436

4537
# 2) If no file config present, construct from environment (legacy behavior)
@@ -120,23 +112,7 @@ def _resolve_placeholder(
120112
llm_cfg.setdefault("embeddings", {})
121113

122114
llm_settings = LLMSettings.from_global_config({"llm": llm_cfg})
123-
provider = create_provider(llm_settings)
124-
125-
# Log provider creation result for debugging
126-
if logger is not None:
127-
try:
128-
provider_type = type(provider).__name__
129-
logger.info(
130-
"LLM provider created",
131-
provider_type=provider_type,
132-
provider_name=llm_cfg.get("provider"),
133-
has_api_key=bool(llm_cfg.get("api_key")),
134-
base_url=llm_cfg.get("base_url"),
135-
)
136-
except Exception:
137-
pass
138-
139-
return provider
115+
return create_provider(llm_settings)
140116
except ImportError:
141117
# Attempt monorepo-relative import by adding sibling core package to sys.path
142118
try:

packages/qdrant-loader-mcp-server/tests/unit/test_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for logging utilities."""
22

3+
import shutil
34
import logging
45
import os
56
import tempfile
@@ -145,7 +146,6 @@ def test_logging_config_setup_with_env_variables():
145146
finally:
146147
# Close all logging handlers before cleanup (Windows compatibility)
147148
logging.shutdown()
148-
import shutil
149149

150150
try:
151151
shutil.rmtree(tmp_dir, ignore_errors=True)

packages/qdrant-loader/tests/unit/config/test_workspace_integration.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ def test_workspace_database_path_override(self, temp_workspace):
174174
expected_path = str(workspace_config.database_path)
175175
actual_path = settings.state_db_path
176176

177-
# Normalize paths for comparison (handles Windows short paths)
178-
from pathlib import Path
179-
177+
# Normalize paths for comparison (handles Windows paths consistently)
180178
assert Path(actual_path).resolve() == Path(expected_path).resolve()
181179
assert actual_path.endswith("qdrant-loader.db")
182180
# Check using resolved paths to handle short vs long path names

packages/qdrant-loader/tests/unit/connectors/localfile/test_localfile_id_consistency.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test document ID consistency for LocalFile connector."""
22

33
import os
4+
import sys
45
import tempfile
56
from pathlib import Path
67

@@ -141,7 +142,6 @@ async def test_document_url_format(self, localfile_config, temp_dir):
141142
@pytest.mark.asyncio
142143
async def test_document_id_consistency_with_symlinks(self, temp_dir):
143144
"""Test that document IDs remain consistent when accessing files through symlinks."""
144-
import sys
145145

146146
# Create a symlink to the temp directory
147147
symlink_dir = Path(temp_dir).parent / "symlink_test"
@@ -152,10 +152,9 @@ async def test_document_id_consistency_with_symlinks(self, temp_dir):
152152
symlink_dir.symlink_to(temp_dir)
153153
except OSError as e:
154154
# Skip test on Windows if user doesn't have symlink privileges
155-
if sys.platform == "win32" and "privilege" in str(e).lower():
155+
if sys.platform == "win32" and getattr(e, "winerror", None) == 1314:
156156
pytest.skip("Symlink creation requires admin privileges on Windows")
157157
raise
158-
159158
try:
160159

161160
# Create test files in the original directory

packages/qdrant-loader/tests/unit/core/file_conversion/test_file_conversion.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import tempfile
55
from pathlib import Path
66
from unittest.mock import Mock, patch
7-
7+
import sys
88
import pytest
99

1010
from qdrant_loader.core.file_conversion import (
@@ -376,7 +376,6 @@ def test_validate_file_not_found(self):
376376

377377
def test_validate_file_not_readable(self):
378378
"""Test file validation with unreadable file."""
379-
import sys
380379

381380
# Skip on Windows - chmod doesn't work the same way
382381
if sys.platform == "win32":

packages/qdrant-loader/tests/unit/core/file_conversion/test_file_converter.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Unit tests for the file converter.
33
"""
44

5-
import signal
5+
import signal, sys
66
import tempfile
77
from pathlib import Path
88
from unittest.mock import MagicMock, patch
@@ -72,14 +72,12 @@ def test_timeout_handler_initialization(self):
7272
assert handler.file_path == "/path/to/file.pdf"
7373
assert handler.old_handler is None
7474

75+
@pytest.mark.skipif(
76+
sys.platform == "win32",
77+
reason="signal.alarm not available on Windows"
78+
)
7579
def test_timeout_handler_context_manager(self):
7680
"""Test timeout handler as context manager."""
77-
import sys
78-
79-
# Skip on Windows - signal.alarm not available
80-
if sys.platform == "win32":
81-
pytest.skip("signal.alarm not available on Windows")
82-
8381
with patch("signal.signal") as mock_signal, patch("signal.alarm") as mock_alarm:
8482
handler = TimeoutHandler(30, "/path/to/file.pdf")
8583

0 commit comments

Comments
 (0)