@@ -95,7 +95,7 @@ def test_install(
9595 store = mm2_installer .record_store
9696 key = mm2_installer .install_path (embedding_file )
9797 model_record = store .get_model (key )
98- assert model_record .path .endswith ("sd-1/embedding /test_embedding.safetensors" )
98+ assert model_record .path .endswith (f" { key } /test_embedding.safetensors" )
9999 assert (mm2_app_config .models_path / model_record .path ).exists ()
100100 assert model_record .source == embedding_file .as_posix ()
101101
@@ -106,23 +106,24 @@ def test_rename(
106106 store = mm2_installer .record_store
107107 key = mm2_installer .install_path (embedding_file )
108108 model_record = store .get_model (key )
109- assert model_record .path .endswith ("sd-1/embedding /test_embedding.safetensors" )
109+ assert model_record .path .endswith (f" { key } /test_embedding.safetensors" )
110110 new_model_record = store .update_model (key , ModelRecordChanges (name = "new model name" , base = BaseModelType ("sd-2" )))
111111 # Renaming the model record shouldn't rename the file
112112 assert new_model_record .name == "new model name"
113- assert new_model_record .path .endswith ("sd-2/embedding /test_embedding.safetensors" )
113+ assert model_record .path .endswith (f" { key } /test_embedding.safetensors" )
114114
115115
116116@pytest .mark .parametrize (
117- "fixture_name,size,destination" ,
117+ "fixture_name,size,key, destination" ,
118118 [
119- ("embedding_file" , 15440 , "sd-1/embedding /test_embedding.safetensors" ),
120- ("diffusers_dir" , 8241 if OS == "Windows" else 7907 , "sdxl/main/test-diffusers-main " ), # EOL chars
119+ ("embedding_file" , 15440 , "foo" , "foo /test_embedding.safetensors" ),
120+ ("diffusers_dir" , 8241 if OS == "Windows" else 7907 , "bar" , "bar " ), # EOL chars
121121 ],
122122)
123123def test_background_install (
124124 mm2_installer : ModelInstallServiceBase ,
125125 fixture_name : str ,
126+ key : str ,
126127 size : int ,
127128 destination : str ,
128129 mm2_app_config : InvokeAIAppConfig ,
@@ -132,7 +133,7 @@ def test_background_install(
132133 path : Path = request .getfixturevalue (fixture_name )
133134 description = "Test of metadata assignment"
134135 source = LocalModelSource (path = path , inplace = False )
135- job = mm2_installer .import_model (source , config = ModelRecordChanges (description = description ))
136+ job = mm2_installer .import_model (source , config = ModelRecordChanges (key = key , description = description ))
136137 assert job is not None
137138 assert isinstance (job , ModelInstallJob )
138139
0 commit comments