@@ -220,9 +220,14 @@ def test_offline_tags(create_plain_run_offline: tuple[sv_run.Run, dict]) -> None
220220
221221@pytest .mark .run
222222def test_update_metadata_running (create_test_run : tuple [sv_run .Run , dict ]) -> None :
223- METADATA = {"a" : 10 , "b" : 1.2 , "c" : "word" }
223+ METADATA = {"a" : 1 , "b" : 1.2 , "c" : "word" , "d" : "new " }
224224 run , _ = create_test_run
225- run .update_metadata (METADATA )
225+ # Add an initial set of metadata
226+ run .update_metadata ({"a" : 10 , "b" : 1.2 , "c" : "word" })
227+ # Try updating a second time, check original dict isnt overwritten
228+ run .update_metadata ({"d" : "new" })
229+ # Try updating an already defined piece of metadata
230+ run .update_metadata ({"a" : 1 })
226231 run .close ()
227232 time .sleep (1.0 )
228233 client = sv_cl .Client ()
@@ -234,9 +239,14 @@ def test_update_metadata_running(create_test_run: tuple[sv_run.Run, dict]) -> No
234239
235240@pytest .mark .run
236241def test_update_metadata_created (create_pending_run : tuple [sv_run .Run , dict ]) -> None :
237- METADATA = {"a" : 10 , "b" : 1.2 , "c" : "word" }
242+ METADATA = {"a" : 1 , "b" : 1.2 , "c" : "word" , "d" : "new " }
238243 run , _ = create_pending_run
239- run .update_metadata (METADATA )
244+ # Add an initial set of metadata
245+ run .update_metadata ({"a" : 10 , "b" : 1.2 , "c" : "word" })
246+ # Try updating a second time, check original dict isnt overwritten
247+ run .update_metadata ({"d" : "new" })
248+ # Try updating an already defined piece of metadata
249+ run .update_metadata ({"a" : 1 })
240250 time .sleep (1.0 )
241251 client = sv_cl .Client ()
242252 run_info = client .get_run (run .id )
@@ -250,13 +260,20 @@ def test_update_metadata_created(create_pending_run: tuple[sv_run.Run, dict]) ->
250260def test_update_metadata_offline (
251261 create_plain_run_offline : tuple [sv_run .Run , dict ],
252262) -> None :
253- METADATA = {"a" : 10 , "b" : 1.2 , "c" : "word" }
263+ METADATA = {"a" : 1 , "b" : 1.2 , "c" : "word" , "d" : "new " }
254264 run , _ = create_plain_run_offline
255265 run_name = run ._name
256- run .update_metadata (METADATA )
266+ # Add an initial set of metadata
267+ run .update_metadata ({"a" : 10 , "b" : 1.2 , "c" : "word" })
268+ # Try updating a second time, check original dict isnt overwritten
269+ run .update_metadata ({"d" : "new" })
270+ # Try updating an already defined piece of metadata
271+ run .update_metadata ({"a" : 1 })
272+
257273 sv_send .sender (os .environ ["SIMVUE_OFFLINE_DIRECTORY" ], 2 , 10 )
258274 run .close ()
259275 time .sleep (1.0 )
276+
260277 client = sv_cl .Client ()
261278 run_info = client .get_run (client .get_run_id_from_name (run_name ))
262279
@@ -655,6 +672,29 @@ def test_update_tags_created(
655672 assert sorted (run_data .tags ) == sorted (tags + ["additional" ])
656673
657674
675+ @pytest .mark .offline
676+ @pytest .mark .run
677+ def test_update_tags_offline (
678+ create_plain_run_offline : typing .Tuple [sv_run .Run , dict ],
679+ ) -> None :
680+ simvue_run , _ = create_plain_run_offline
681+ run_name = simvue_run ._name
682+
683+ simvue_run .set_tags (["simvue_client_unit_tests" ,])
684+
685+ simvue_run .update_tags (["additional" ])
686+
687+ sv_send .sender (os .environ ["SIMVUE_OFFLINE_DIRECTORY" ], 2 , 10 )
688+ simvue_run .close ()
689+ time .sleep (1.0 )
690+
691+ client = sv_cl .Client ()
692+ run_data = client .get_run (client .get_run_id_from_name (run_name ))
693+
694+ time .sleep (1 )
695+ run_data = client .get_run (simvue_run ._id )
696+ assert sorted (run_data .tags ) == sorted (["simvue_client_unit_tests" , "additional" ])
697+
658698@pytest .mark .run
659699@pytest .mark .parametrize ("object_type" , ("DataFrame" , "ndarray" ))
660700def test_save_object (
0 commit comments