@@ -296,174 +296,172 @@ def test_cli_run_submit_and_describe_and_cancel_and_download_and_delete( # noqa
296296 assert run_id_match , f"Failed to extract run ID from output '{ output } '"
297297 run_id = run_id_match .group (1 )
298298
299- # TODO (Andreas): Causes internal server errors on some runs
300- if False :
301- # Test that we can find this run by it's note via the query parameter
302- list_result = runner .invoke (
303- cli ,
304- [
305- "application" ,
306- "run" ,
307- "list" ,
308- "--query" ,
309- "note_of_this_complex_test" ,
310- ],
311- )
312- assert list_result .exit_code == 0
313- list_output = normalize_output (list_result .stdout )
314- assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by note via query"
315-
316- # Test that we can find this run by it's tag via the query parameter
317- list_result = runner .invoke (
318- cli ,
319- [
320- "application" ,
321- "run" ,
322- "list" ,
323- "--query" ,
324- "test_cli_run_submit_and_describe_and_cancel_and_download_and_delete" ,
325- ],
326- )
327- assert list_result .exit_code == 0
328- list_output = normalize_output (list_result .stdout )
329- assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by tag via query"
330-
331- # Test that we cannot find this run by another tag via the query parameter
332- list_result = runner .invoke (
333- cli ,
334- [
335- "application" ,
336- "run" ,
337- "list" ,
338- "--query" ,
339- "another_tag" ,
340- ],
341- )
342- assert list_result .exit_code == 0
343- list_output = normalize_output (list_result .stdout )
344- assert run_id not in list_output , f"Run ID '{ run_id } ' found when filtering by another tag via query"
345-
346- # Test that we can find this run by it's note
347- list_result = runner .invoke (
348- cli ,
349- [
350- "application" ,
351- "run" ,
352- "list" ,
353- "--note-regex" ,
354- "note_of_this_complex_test" ,
355- ],
356- )
357- assert list_result .exit_code == 0
358- list_output = normalize_output (list_result .stdout )
359- assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by note"
360-
361- # but not another note
362- list_result = runner .invoke (
363- cli ,
364- [
365- "application" ,
366- "run" ,
367- "list" ,
368- "--note-regex" ,
369- "other_note" ,
370- ],
371- )
372- assert list_result .exit_code == 0
373- list_output = normalize_output (list_result .stdout )
374- assert run_id not in list_output , f"Run ID '{ run_id } ' found when filtering by other note"
375-
376- # Test that we can find this run by one of its tags
377- list_result = runner .invoke (
378- cli ,
379- [
380- "application" ,
381- "run" ,
382- "list" ,
383- "--tags" ,
384- "test_cli_run_submit_and_describe_and_cancel_and_download_and_delete" ,
385- ],
386- )
387- assert list_result .exit_code == 0
388- list_output = normalize_output (list_result .stdout )
389- assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by one tag"
390-
391- # but not another tag
392- list_result = runner .invoke (
393- cli ,
394- [
395- "application" ,
396- "run" ,
397- "list" ,
398- "--tags" ,
399- "other-tag" ,
400- ],
401- )
402- assert list_result .exit_code == 0
403- list_output = normalize_output (list_result .stdout )
404- assert run_id not in list_output , f"Run ID '{ run_id } ' found when filtering by other tag"
405-
406- # Test that we can find this run by two of its tags
407- list_result = runner .invoke (
408- cli ,
409- [
410- "application" ,
411- "run" ,
412- "list" ,
413- "--tags" ,
414- "cli-test,test_cli_run_submit_and_describe_and_cancel_and_download_and_delete" ,
415- ],
416- )
417- assert list_result .exit_code == 0
418- list_output = normalize_output (list_result .stdout )
419- assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by two tags"
420-
421- # Test that we can find this run by all of its tags
422- list_result = runner .invoke (
423- cli ,
424- [
425- "application" ,
426- "run" ,
427- "list" ,
428- "--tags" ,
429- "cli-test,test_cli_run_submit_and_describe_and_cancel_and_download_and_delete,further-tag" ,
430- ],
431- )
432- assert list_result .exit_code == 0
433- list_output = normalize_output (list_result .stdout )
434- assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by all tags"
435-
436- # Test that we cannot find this run by all of its tags and a non-existent tag
437- list_result = runner .invoke (
438- cli ,
439- [
440- "application" ,
441- "run" ,
442- "list" ,
443- "--tags" ,
444- "cli-test,test_cli_run_submit_and_describe_and_cancel_and_download_and_delete,further-tag,non-existing-tag" ,
445- ],
446- )
447- assert list_result .exit_code == 0
448- list_output = normalize_output (list_result .stdout )
449- assert run_id not in list_output , f"Run ID '{ run_id } ' found when filtering by all tags"
450-
451- # Test that we can find this run by all of its tags and it's note
452- list_result = runner .invoke (
453- cli ,
454- [
455- "application" ,
456- "run" ,
457- "list" ,
458- "--note-regex" ,
459- "note_of_this_complex_test" ,
460- "--tags" ,
461- "cli-test,test_cli_run_submit_and_describe_and_cancel_and_download_and_delete,further-tag" ,
462- ],
463- )
464- assert list_result .exit_code == 0
465- list_output = normalize_output (list_result .stdout )
466- assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by all tags and note"
299+ # Test that we can find this run by it's note via the query parameter
300+ list_result = runner .invoke (
301+ cli ,
302+ [
303+ "application" ,
304+ "run" ,
305+ "list" ,
306+ "--query" ,
307+ "note_of_this_complex_test" ,
308+ ],
309+ )
310+ assert list_result .exit_code == 0
311+ list_output = normalize_output (list_result .stdout )
312+ assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by note via query"
313+
314+ # Test that we can find this run by it's tag via the query parameter
315+ list_result = runner .invoke (
316+ cli ,
317+ [
318+ "application" ,
319+ "run" ,
320+ "list" ,
321+ "--query" ,
322+ "test_cli_run_submit_and_describe_and_cancel_and_download_and_delete" ,
323+ ],
324+ )
325+ assert list_result .exit_code == 0
326+ list_output = normalize_output (list_result .stdout )
327+ assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by tag via query"
328+
329+ # Test that we cannot find this run by another tag via the query parameter
330+ list_result = runner .invoke (
331+ cli ,
332+ [
333+ "application" ,
334+ "run" ,
335+ "list" ,
336+ "--query" ,
337+ "another_tag" ,
338+ ],
339+ )
340+ assert list_result .exit_code == 0
341+ list_output = normalize_output (list_result .stdout )
342+ assert run_id not in list_output , f"Run ID '{ run_id } ' found when filtering by another tag via query"
343+
344+ # Test that we can find this run by it's note
345+ list_result = runner .invoke (
346+ cli ,
347+ [
348+ "application" ,
349+ "run" ,
350+ "list" ,
351+ "--note-regex" ,
352+ "note_of_this_complex_test" ,
353+ ],
354+ )
355+ assert list_result .exit_code == 0
356+ list_output = normalize_output (list_result .stdout )
357+ assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by note"
358+
359+ # but not another note
360+ list_result = runner .invoke (
361+ cli ,
362+ [
363+ "application" ,
364+ "run" ,
365+ "list" ,
366+ "--note-regex" ,
367+ "other_note" ,
368+ ],
369+ )
370+ assert list_result .exit_code == 0
371+ list_output = normalize_output (list_result .stdout )
372+ assert run_id not in list_output , f"Run ID '{ run_id } ' found when filtering by other note"
373+
374+ # Test that we can find this run by one of its tags
375+ list_result = runner .invoke (
376+ cli ,
377+ [
378+ "application" ,
379+ "run" ,
380+ "list" ,
381+ "--tags" ,
382+ "test_cli_run_submit_and_describe_and_cancel_and_download_and_delete" ,
383+ ],
384+ )
385+ assert list_result .exit_code == 0
386+ list_output = normalize_output (list_result .stdout )
387+ assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by one tag"
388+
389+ # but not another tag
390+ list_result = runner .invoke (
391+ cli ,
392+ [
393+ "application" ,
394+ "run" ,
395+ "list" ,
396+ "--tags" ,
397+ "other-tag" ,
398+ ],
399+ )
400+ assert list_result .exit_code == 0
401+ list_output = normalize_output (list_result .stdout )
402+ assert run_id not in list_output , f"Run ID '{ run_id } ' found when filtering by other tag"
403+
404+ # Test that we can find this run by two of its tags
405+ list_result = runner .invoke (
406+ cli ,
407+ [
408+ "application" ,
409+ "run" ,
410+ "list" ,
411+ "--tags" ,
412+ "cli-test,test_cli_run_submit_and_describe_and_cancel_and_download_and_delete" ,
413+ ],
414+ )
415+ assert list_result .exit_code == 0
416+ list_output = normalize_output (list_result .stdout )
417+ assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by two tags"
418+
419+ # Test that we can find this run by all of its tags
420+ list_result = runner .invoke (
421+ cli ,
422+ [
423+ "application" ,
424+ "run" ,
425+ "list" ,
426+ "--tags" ,
427+ "cli-test,test_cli_run_submit_and_describe_and_cancel_and_download_and_delete,further-tag" ,
428+ ],
429+ )
430+ assert list_result .exit_code == 0
431+ list_output = normalize_output (list_result .stdout )
432+ assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by all tags"
433+
434+ # Test that we cannot find this run by all of its tags and a non-existent tag
435+ list_result = runner .invoke (
436+ cli ,
437+ [
438+ "application" ,
439+ "run" ,
440+ "list" ,
441+ "--tags" ,
442+ "cli-test,test_cli_run_submit_and_describe_and_cancel_and_download_and_delete,further-tag,non-existing-tag" ,
443+ ],
444+ )
445+ assert list_result .exit_code == 0
446+ list_output = normalize_output (list_result .stdout )
447+ assert run_id not in list_output , f"Run ID '{ run_id } ' found when filtering by all tags"
448+
449+ # Test that we can find this run by all of its tags and it's note
450+ list_result = runner .invoke (
451+ cli ,
452+ [
453+ "application" ,
454+ "run" ,
455+ "list" ,
456+ "--note-regex" ,
457+ "note_of_this_complex_test" ,
458+ "--tags" ,
459+ "cli-test,test_cli_run_submit_and_describe_and_cancel_and_download_and_delete,further-tag" ,
460+ ],
461+ )
462+ assert list_result .exit_code == 0
463+ list_output = normalize_output (list_result .stdout )
464+ assert run_id in list_output , f"Run ID '{ run_id } ' not found when filtering by all tags and note"
467465
468466 # Test the describe command with the extracted run ID
469467 describe_result = runner .invoke (cli , ["application" , "run" , "describe" , run_id ])
@@ -920,27 +918,24 @@ def test_cli_run_dump_and_update_item_custom_metadata(runner: CliRunner) -> None
920918 assert result .exit_code == 0
921919
922920 normalized_describe = normalize_output (result .output )
923- # Match the line after "Item External ID:"
924- external_id_match = re .search (r"Item External ID:\s*\n\s*([^\s]+)" , normalized_describe )
925-
926- if not external_id_match :
927- # Try single line format as fallback
928- external_id_match = re .search (r"Item External ID:\s*([^\n\s]+)" , normalized_describe )
921+ # Match the external ID wrapped in backticks - external ID can contain spaces
922+ external_id_match = re .search (r"Item External ID:\s*`([^`]+)`" , normalized_describe )
929923
930924 if not external_id_match :
931925 pytest .skip ("Could not extract item external_id from run. Run may not have items yet." )
932926
933927 external_id = external_id_match .group (1 ).strip ()
928+ print (run_id )
934929 print (external_id )
935930
936931 # Step 2: Dump custom metadata of item
937932 result = runner .invoke (cli , ["application" , "run" , "dump-item-metadata" , run_id , external_id ])
938- assert result .exit_code == 0
939933 initial_metadata = json .loads (result .output )
940934 # If metadata is None/null, start with empty dict
941935 if initial_metadata is None :
942936 initial_metadata = {}
943937 assert isinstance (initial_metadata , dict ), "Custom metadata should be a dictionary"
938+ assert result .exit_code == 0
944939
945940 # Store initial SDK metadata timestamps for comparison
946941 initial_created_at = initial_metadata .get ("sdk" , {}).get ("created_at" )
@@ -963,10 +958,10 @@ def test_cli_run_dump_and_update_item_custom_metadata(runner: CliRunner) -> None
963958
964959 # Step 4: Dump metadata again and verify random number appeared
965960 result = runner .invoke (cli , ["application" , "run" , "dump-item-metadata" , run_id , external_id , "--pretty" ])
966- assert result .exit_code == 0
967961 metadata_with_random = json .loads (result .output )
968962 assert "random" in metadata_with_random , "Random field should be present in metadata"
969963 assert metadata_with_random ["random" ] == random_value , f"Random value should be { random_value } "
964+ assert result .exit_code == 0
970965
971966 # Verify SDK metadata timestamps behavior after update
972967 updated_created_at = metadata_with_random .get ("sdk" , {}).get ("created_at" )
0 commit comments