MCPcopy
hub / github.com/llmware-ai/llmware / test_setup_custom_location

Function test_setup_custom_location

tests/configs/test_path_overrides.py:33–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31
32# Test overriding llmware_data folder
33def test_setup_custom_location():
34
35 # upstream application creating custom home path, e.g., aibloks
36 new_home_folder = "llmware_data_custom"
37 LLMWareConfig.set_home(os.path.join(LLMWareConfig.get_home(), new_home_folder))
38
39 new_llmware_path = "aibloks_data"
40 LLMWareConfig.set_llmware_path_name(new_llmware_path)
41
42 # Make folders if they don't already exist
43 if not os.path.exists(LLMWareConfig().get_home()):
44 os.mkdir(LLMWareConfig().get_home())
45 if not os.path.exists(LLMWareConfig().get_llmware_path()):
46 LLMWareConfig.setup_llmware_workspace()
47
48 assert new_home_folder in LLMWareConfig.get_home(), "Custom home folder not set correctly."
49 assert new_home_folder in LLMWareConfig.get_llmware_path() and new_llmware_path in LLMWareConfig.get_llmware_path(), "Custom LLMWare path not set correctly."
50 assert new_home_folder in LLMWareConfig.get_library_path() and new_llmware_path in LLMWareConfig.get_library_path(), "Library path not set correctly."
51
52 # test with library setup and adding files
53 library_name = "library_with_custom_path"
54 library = Library().create_new_library(library_name)
55 sample_files_path = Setup().load_sample_files()
56 library.add_files(os.path.join(sample_files_path,"Agreements"))
57
58 assert new_home_folder in library.library_main_path, "Custom path not found in library main path."
59
60 results = Query(library).text_query("salary")
61
62 assert len(results) > 0
63
64

Callers

nothing calls this directly

Calls 14

LLMWareConfigClass · 0.90
LibraryClass · 0.90
SetupClass · 0.90
QueryClass · 0.90
set_homeMethod · 0.80
get_homeMethod · 0.80
set_llmware_path_nameMethod · 0.80
get_llmware_pathMethod · 0.80
get_library_pathMethod · 0.80
create_new_libraryMethod · 0.80
load_sample_filesMethod · 0.80

Tested by

no test coverage detected