Orchestrata Ultimate › Tests › Reference › knowledge_graph › test_file_watcher

Tests reference — tests/knowledge_graph/test_file_watcher.py

Module of tests/knowledge_graph, split out because the directory page would be too large.

Prose pending.

tests/knowledge_graph/test_file_watcher.py

source · 24 tests · 384 lines

Tests for FileWatcher with debouncing.

Covers: knowledge_graph.code_parser, knowledge_graph.config, knowledge_graph.file_watcher, knowledge_graph.synchronizer

Kind Name Line Description
class TestFileWatcherInit 55 Test FileWatcher initialization.
method TestFileWatcherInit.test_init_defaults 58 Watcher starts in stopped state.
method TestFileWatcherInit.test_init_stores_project_path 63 Project path is stored correctly.
method TestFileWatcherInit.test_init_uses_default_config 74 Default SyncConfig when none provided.
class TestFilterChanges 83 Test change filtering logic.
method TestFilterChanges.test_filters_by_extension 86 Only watched extensions pass through.
method TestFilterChanges.test_filters_ignore_patterns 101 Files matching ignore patterns are excluded.
method TestFilterChanges.test_filters_pyc_glob 115 Glob patterns like *.pyc are matched.
method TestFilterChanges.test_empty_changes_returns_empty 125 Empty input yields empty output.
class TestMatchesIgnore 131 Test ignore pattern matching.
method TestMatchesIgnore.test_directory_name_match 134 Directory names in path parts are matched.
method TestMatchesIgnore.test_glob_pattern_match 141 Glob patterns match filename.
method TestMatchesIgnore.test_no_match 148 Non-matching paths return False.
class TestStartStop 156 Test watcher lifecycle.
method TestStartStop.test_start_sets_running 160 Watcher is running after start.
method TestStartStop.test_stop_clears_running 167 Watcher is stopped after stop.
method TestStartStop.test_double_start_is_idempotent 174 Calling start twice does not crash.
method TestStartStop.test_double_stop_is_idempotent 182 Calling stop twice does not crash.
class TestDebounceAndBatching 189 Test debounce behaviour with real filesystem writes.
method TestDebounceAndBatching.test_rapid_writes_debounce_into_batch 193 Writing 10 files rapidly produces fewer batches than files.
method TestDebounceAndBatching.test_modify_detected 219 Modified files are detected and synced.
class TestDeleteDetection 242 Test file deletion handling.
method TestDeleteDetection.test_delete_detected_without_neo4j 246 Deletion is detected; without graph client, logs warning.
class TestReconciliation 270 Test startup hash reconciliation.
method TestReconciliation.test_new_files_synced_on_startup 274 Files present before start get reconciled.
method TestReconciliation.test_already_synced_files_skipped 295 Files already in hash cache are not re-synced.
class TestIgnorePatterns 319 Test that ignore patterns are respected end-to-end.
method TestIgnorePatterns.test_pycache_ignored 323 Files in pycache are not synced.
method TestIgnorePatterns.test_non_watched_extension_ignored 343 Files with unwatched extensions are ignored.
class TestMaxBatchSize 362 Test the max batch cap constant.
method TestMaxBatchSize.test_max_batch_size_is_200 365 The max batch cap is 200.
class TestSynchronizerWatchIntegration 370 Test FileSynchronizer.watch() creates a FileWatcher.
method TestSynchronizerWatchIntegration.test_watch_returns_file_watcher 373 watch() returns a FileWatcher instance.
method TestSynchronizerWatchIntegration.test_stop_watching_clears_watcher 379 stop_watching() clears the watcher reference.