Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,280 changes: 1,207 additions & 1,073 deletions coverage.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ addopts = [
"--cov-report=html",
"--cov-report=xml",
"--cov-fail-under=80",
"--import-mode=importlib",
]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
Expand Down
2 changes: 1 addition & 1 deletion src/codeweaver/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
from typing import Final


__version__: Final[str] = "0.0.1rc295+gfc4f90a"
__version__: Final[str] = "0.0.1rc3+g76d9888"

__all__ = ("__version__",)
3 changes: 3 additions & 0 deletions tests/benchmark/chunker/test_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
from codeweaver.engine.chunker.selector import ChunkerSelector
from codeweaver.providers.embedding.capabilities.base import EmbeddingModelCapabilities

pytestmark = [pytest.mark.benchmark, pytest.mark.performance, pytest.mark.slow]



# Test data generators
def generate_python_file(num_lines: int) -> str:
Expand Down
2 changes: 1 addition & 1 deletion tests/contract/test_memory_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from codeweaver.core.spans import Span
from codeweaver.providers.vector_stores.inmemory import MemoryVectorStore


pytestmark = pytest.mark.unit



@pytest.fixture
def temp_persist_path():
"""Provide temporary persistence path for testing."""
Expand Down
5 changes: 3 additions & 2 deletions tests/contract/test_qdrant_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
from codeweaver.core.spans import Span
from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore


# Mark all tests in this module as requiring Qdrant
pytestmark = [pytest.mark.integration, pytest.mark.external_api]



# Mark all tests in this module as requiring Qdrant

@pytest.fixture
async def qdrant_config():
"""Provide test Qdrant configuration."""
Expand Down
1 change: 1 addition & 0 deletions tests/contract/test_vector_store_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from codeweaver.providers.vector_stores.base import VectorStoreProvider

pytestmark = [pytest.mark.unit, pytest.mark.validation]

class TestVectorStoreProviderContract:
"""Test VectorStoreProvider abstract interface contract compliance."""
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/chunker/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

from codeweaver.engine.chunker.selector import ChunkerSelector

pytestmark = [pytest.mark.integration]



@pytest.fixture
def mock_governor():
Expand Down Expand Up @@ -263,6 +266,9 @@ def test_e2e_parallel_dict_convenience():
from codeweaver.engine.chunker.parallel import chunk_files_parallel_dict
from codeweaver.providers.embedding.capabilities.base import EmbeddingModelCapabilities




# Get sample files
fixture_dir = Path("tests/fixtures")
files = []
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_custom_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@

from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore


pytestmark = [pytest.mark.integration, pytest.mark.external_api]






async def test_custom_configuration():
"""
User Story: Customize provider settings like collection names.
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_hybrid_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
from codeweaver.core.language import SemanticSearchLanguage as Language
from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore


pytestmark = [pytest.mark.integration, pytest.mark.external_api]






async def test_hybrid_search_ranking():
"""
User Story: Hybrid search combines sparse and dense for better relevance.
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_hybrid_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
from codeweaver.core.language import SemanticSearchLanguage as Language
from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore


pytestmark = [pytest.mark.integration, pytest.mark.external_api]






@pytest.fixture
async def qdrant_provider():
"""Create Qdrant provider for testing."""
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_incremental_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
from codeweaver.core.language import SemanticSearchLanguage as Language
from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore


pytestmark = [pytest.mark.integration, pytest.mark.external_api]






async def test_incremental_updates():
"""
User Story: File updates only re-index changed chunks.
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_memory_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
from codeweaver.core.language import SemanticSearchLanguage as Language
from codeweaver.providers.vector_stores.inmemory import MemoryVectorStore


pytestmark = pytest.mark.integration






async def test_inmemory_persistence():
"""
User Story: Use in-memory storage with automatic persistence.
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_partial_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
from codeweaver.core.language import SemanticSearchLanguage as Language
from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore


pytestmark = [pytest.mark.integration, pytest.mark.external_api]






async def test_partial_embeddings():
"""
User Story: Handle cases where dense embedding generation fails.
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/test_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
from codeweaver.core.language import SemanticSearchLanguage as Language
from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore


pytestmark = [pytest.mark.integration, pytest.mark.external_api]






async def test_persistence_across_restarts():
"""
User Story: Previously indexed data persists across restarts.
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_provider_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
from codeweaver.providers.vector_stores.inmemory import MemoryVectorStore
from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore


pytestmark = [pytest.mark.integration, pytest.mark.external_api]


async def test_provider_switch_detection():
"""
User Story: Warn when switching providers to prevent data loss.
Expand Down
6 changes: 6 additions & 0 deletions tests/performance/test_vector_store_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
from codeweaver.providers.vector_stores.inmemory import MemoryVectorStore
from codeweaver.providers.vector_stores.qdrant import QdrantVectorStore

pytestmark = [pytest.mark.async_test, pytest.mark.performance, pytest.mark.slow]






# Test data generation helpers
def create_test_chunk(
Expand Down
2 changes: 2 additions & 0 deletions tests/test_delimiters.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
matches_pattern,
)

pytestmark = [pytest.mark.unit]


class TestDelimiterPattern:
"""Test DelimiterPattern DSL and expansion."""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_lazy_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from codeweaver.common.utils.lazy_importer import LazyImport, lazy_import

pytestmark = [pytest.mark.unit]


class TestLazyImportBasics:
"""Test basic LazyImport functionality."""
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/engine/chunker/test_delimiter_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
from codeweaver.engine.chunker.delimiter import DelimiterChunker
from codeweaver.engine.chunker.delimiters.kind import DelimiterKind

pytestmark = [pytest.mark.unit]



@pytest.fixture
def governor() -> ChunkGovernor:
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/engine/chunker/test_delimiter_edge_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from codeweaver.engine.chunker.base import ChunkGovernor
from codeweaver.engine.chunker.delimiter import DelimiterChunker

pytestmark = [pytest.mark.unit]



@pytest.fixture
def delimiter_chunker(chunk_governor: ChunkGovernor) -> DelimiterChunker:
Expand Down Expand Up @@ -337,7 +340,6 @@ def test_unmatched_delimiters(

# Create DiscoveredFile - should not crash, should produce some chunks
from codeweaver.core.discovery import DiscoveredFile

discovered_file = DiscoveredFile.from_path(file_path)
chunks = delimiter_chunker.chunk(content, file=discovered_file)

Expand Down
2 changes: 2 additions & 0 deletions tests/unit/engine/chunker/test_governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from codeweaver.engine.chunker.exceptions import ChunkingTimeoutError, ChunkLimitExceededError
from codeweaver.engine.chunker.governance import ResourceGovernor

pytestmark = [pytest.mark.unit]


class PerformanceSettings(Protocol):
"""Minimal protocol for testing."""
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/engine/chunker/test_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
from pathlib import Path
from unittest.mock import Mock

import pytest

from codeweaver.engine.chunker.base import ChunkGovernor
from codeweaver.engine.chunker.delimiter import DelimiterChunker
from codeweaver.engine.chunker.selector import ChunkerSelector
from codeweaver.engine.chunker.semantic import SemanticChunker

pytestmark = [pytest.mark.unit]


def test_selector_chooses_semantic_for_python(chunk_governor: ChunkGovernor) -> None:
"""Verify selector picks semantic for supported language."""
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/engine/chunker/test_semantic_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
Python, JavaScript, and Rust.
"""


import pytest

from codeweaver.core.language import SemanticSearchLanguage
from codeweaver.engine.chunker import SemanticChunker
from codeweaver.engine.chunker.base import ChunkGovernor

pytestmark = [pytest.mark.unit]


def test_semantic_chunks_python_file(
chunk_governor: ChunkGovernor, discovered_sample_python_file
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/engine/chunker/test_semantic_dedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from codeweaver.engine.chunker.base import ChunkGovernor
from codeweaver.engine.chunker.semantic import SemanticChunker

pytestmark = [pytest.mark.unit]



@pytest.fixture
def chunk_governor() -> ChunkGovernor:
Expand Down Expand Up @@ -257,6 +260,7 @@ def test_batch_id_tracking(
# Create DiscoveredFile and chunk the file
from codeweaver.core.discovery import DiscoveredFile


discovered_file = DiscoveredFile.from_path(python_file_with_unique_functions)
chunks = semantic_chunker.chunk(content, file=discovered_file)

Expand Down
2 changes: 2 additions & 0 deletions tests/unit/engine/chunker/test_semantic_edge_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from codeweaver.engine.chunker.base import ChunkGovernor
from codeweaver.engine.chunker.exceptions import BinaryFileError

pytestmark = [pytest.mark.unit]


def test_empty_file(chunk_governor: ChunkGovernor, discovered_empty_file) -> None:
"""Verify empty file returns empty list."""
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/engine/chunker/test_semantic_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
if TYPE_CHECKING:
from pytest import MonkeyPatch

pytestmark = [pytest.mark.unit]


# Path to test fixtures directory
FIXTURES_DIR = Path(__file__).parent.parent.parent.parent / "fixtures"

Expand Down
2 changes: 2 additions & 0 deletions tests/unit/engine/chunker/test_semantic_oversized.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from codeweaver.engine.chunker.base import ChunkGovernor
from codeweaver.engine.chunker.semantic import SemanticChunker

pytestmark = [pytest.mark.unit]


@pytest.fixture
def python_chunker(chunk_governor: ChunkGovernor) -> SemanticChunker:
Expand Down
Loading