diff --git a/src/processor/org_mode/orgnode.py b/src/processor/org_mode/orgnode.py index 31cedbb9..5f47a448 100644 --- a/src/processor/org_mode/orgnode.py +++ b/src/processor/org_mode/orgnode.py @@ -57,12 +57,7 @@ def makelist(filename): """ ctr = 0 - try: - f = open(filename, 'r') - except IOError: - print(f"Unable to open file {filename}") - print("Program terminating.") - sys.exit(1) + f = open(filename, 'r') todos = { "TODO": "", "WAITING": "", "ACTIVE": "", "DONE": "", "CANCELLED": "", "FAILED": ""} # populated from #+SEQ_TODO line diff --git a/tests/test_text_search.py b/tests/test_text_search.py index dce1070a..20e0aea0 100644 --- a/tests/test_text_search.py +++ b/tests/test_text_search.py @@ -13,6 +13,20 @@ from src.processor.org_mode.org_to_jsonl import org_to_jsonl # Test +# ---------------------------------------------------------------------------------------------------- +def test_asymmetric_setup_with_missing_file_raises_error(content_config: ContentConfig, search_config: SearchConfig): + # Arrange + file_to_index = Path(content_config.org.input_filter).parent / "new_file_to_index.org" + new_org_content_config = deepcopy(content_config.org) + new_org_content_config.input_files = [f'{file_to_index}'] + new_org_content_config.input_filter = None + + # Act + # Generate notes embeddings during asymmetric setup + with pytest.raises(FileNotFoundError): + text_search.setup(org_to_jsonl, new_org_content_config, search_config.asymmetric, regenerate=True) + + # ---------------------------------------------------------------------------------------------------- def test_asymmetric_setup_with_empty_file_raises_error(content_config: ContentConfig, search_config: SearchConfig): # Arrange