diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d2a775..1a4d95a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## [Unreleased] +- **Test Environment & Import Fallback Hygiene (Pfad A, 2026-11-01)**: + - **Pytest Conftest Setup**: Added ests/conftest.py ensuring repo root is inserted into sys.path and providing fallback KnowledgeDigest module alias during direct test runs without prior pip install -e .. + - **Graceful Import Fallback in est_transit.py**: Added ry...except ImportError fallback for KnowledgeDigest.schema and KnowledgeDigest.transit imports, ensuring standalone execution parity with est_core.py and est_bach_import.py. + - **Test Suite Verification**: Verified all 219 tests pass (1 skipped for optional sqlite-transit-sync), +uff check reports 0 errors, compileall clean, and all contract tests green. Version 0.4.0 strictly unchanged (T-20260920-167562623). + + - **Documentation and package boundary corrections (2026-10-12)**: Clarified that core indexing/search use the local database while optional provider and synchronization paths may transfer configured data; corrected CLI/configuration documentation; bounded dependency/license and security statements; added a wheel/sdist smoke gate for the packaged GUI icon. Version remains 0.4.0. - **Bugfix-Sweep (2026-10-06)**: diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..91a0a26 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +"""Pytest fixtures and configuration for KnowledgeDigest test suite.""" + +import sys +import types +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parent.parent + +if str(REPO_ROOT) not in sys.path: + sys.path.insert(0, str(REPO_ROOT)) + +# Provide package fallback when running tests directly without editable install +if "KnowledgeDigest" not in sys.modules: + pkg = types.ModuleType("KnowledgeDigest") + pkg.__path__ = [str(REPO_ROOT)] + sys.modules["KnowledgeDigest"] = pkg diff --git a/tests/test_transit.py b/tests/test_transit.py index 26f31cf..b0e2b8a 100644 --- a/tests/test_transit.py +++ b/tests/test_transit.py @@ -21,16 +21,28 @@ except ImportError: # optional dependency, see transit.py SyncError = None -from KnowledgeDigest.schema import ensure_schema -from KnowledgeDigest.transit import ( - TRANSIT_SYNC_AVAILABLE, - generate_chunk_key, - ChunkTaskManager, - KnowledgeDigestMergePolicy, - create_knowledge_sync, - utc_now, - iso_timestamp, -) +try: + from KnowledgeDigest.schema import ensure_schema + from KnowledgeDigest.transit import ( + TRANSIT_SYNC_AVAILABLE, + generate_chunk_key, + ChunkTaskManager, + KnowledgeDigestMergePolicy, + create_knowledge_sync, + utc_now, + iso_timestamp, + ) +except ImportError: + from schema import ensure_schema + from transit import ( + TRANSIT_SYNC_AVAILABLE, + generate_chunk_key, + ChunkTaskManager, + KnowledgeDigestMergePolicy, + create_knowledge_sync, + utc_now, + iso_timestamp, + ) requires_transit_sync = pytest.mark.skipif( not TRANSIT_SYNC_AVAILABLE, reason="optional package sqlite-transit-sync not installed"