@@ -95,7 +95,7 @@ def test_install(
95
95
store = mm2_installer .record_store
96
96
key = mm2_installer .install_path (embedding_file )
97
97
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" )
99
99
assert (mm2_app_config .models_path / model_record .path ).exists ()
100
100
assert model_record .source == embedding_file .as_posix ()
101
101
@@ -106,23 +106,24 @@ def test_rename(
106
106
store = mm2_installer .record_store
107
107
key = mm2_installer .install_path (embedding_file )
108
108
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" )
110
110
new_model_record = store .update_model (key , ModelRecordChanges (name = "new model name" , base = BaseModelType ("sd-2" )))
111
111
# Renaming the model record shouldn't rename the file
112
112
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" )
114
114
115
115
116
116
@pytest .mark .parametrize (
117
- "fixture_name,size,destination" ,
117
+ "fixture_name,size,key, destination" ,
118
118
[
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
121
121
],
122
122
)
123
123
def test_background_install (
124
124
mm2_installer : ModelInstallServiceBase ,
125
125
fixture_name : str ,
126
+ key : str ,
126
127
size : int ,
127
128
destination : str ,
128
129
mm2_app_config : InvokeAIAppConfig ,
@@ -132,7 +133,7 @@ def test_background_install(
132
133
path : Path = request .getfixturevalue (fixture_name )
133
134
description = "Test of metadata assignment"
134
135
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 ))
136
137
assert job is not None
137
138
assert isinstance (job , ModelInstallJob )
138
139
0 commit comments