@@ -341,7 +341,7 @@ def test_process_shortcuts_with_complex_regex_pattern(mock_fabric_workspace, moc
341341 assert published_shortcut ["name" ] == "prod_shortcut"
342342
343343
344- def test_shortcut_smart_diff_skips_unchanged_shortcuts (mock_fabric_workspace , mock_item , restore_feature_flags ):
344+ def test_shortcut_smart_diff_skips_unchanged_shortcuts (mock_fabric_workspace , mock_item ):
345345 """Smart diff should skip publish for unchanged shortcuts."""
346346 shortcuts_data = [
347347 {
@@ -372,15 +372,16 @@ def test_shortcut_smart_diff_skips_unchanged_shortcuts(mock_fabric_workspace, mo
372372
373373 mock_item .item_files = [create_shortcut_file (shortcuts_data )]
374374 set_deployed_shortcuts (mock_fabric_workspace , deployed_shortcuts )
375- constants .FEATURE_FLAG .add (FeatureFlag .ENABLE_SHORTCUT_SMART_DIFF .value )
375+ constants .FEATURE_FLAG .add ("enable_shortcut_smart_diff" )
376+ try :
377+ ShortcutPublisher (mock_fabric_workspace , mock_item ).publish_all ()
378+ post_calls = get_shortcut_post_calls (mock_fabric_workspace )
379+ assert len (post_calls ) == 0
380+ finally :
381+ constants .FEATURE_FLAG .discard ("enable_shortcut_smart_diff" )
376382
377- ShortcutPublisher (mock_fabric_workspace , mock_item ).publish_all ()
378-
379- post_calls = get_shortcut_post_calls (mock_fabric_workspace )
380- assert len (post_calls ) == 0
381383
382-
383- def test_shortcut_smart_diff_publishes_only_changed_shortcut (mock_fabric_workspace , mock_item , restore_feature_flags ):
384+ def test_shortcut_smart_diff_publishes_only_changed_shortcut (mock_fabric_workspace , mock_item ):
384385 """Smart diff should publish only shortcuts with changed fields."""
385386 shortcuts_data = [
386387 {
@@ -409,17 +410,19 @@ def test_shortcut_smart_diff_publishes_only_changed_shortcut(mock_fabric_workspa
409410
410411 mock_item .item_files = [create_shortcut_file (shortcuts_data )]
411412 set_deployed_shortcuts (mock_fabric_workspace , deployed_shortcuts )
412- constants .FEATURE_FLAG .add (FeatureFlag .ENABLE_SHORTCUT_SMART_DIFF .value )
413+ constants .FEATURE_FLAG .add ("enable_shortcut_smart_diff" )
414+ try :
415+ ShortcutPublisher (mock_fabric_workspace , mock_item ).publish_all ()
413416
414- ShortcutPublisher ( mock_fabric_workspace , mock_item ). publish_all ( )
415-
416- post_calls = get_shortcut_post_calls ( mock_fabric_workspace )
417- assert len ( post_calls ) == 1
418- assert post_calls [ 0 ][ 1 ][ "body" ][ "name" ] == "shortcut2"
417+ post_calls = get_shortcut_post_calls ( mock_fabric_workspace )
418+ assert len ( post_calls ) == 1
419+ assert post_calls [ 0 ][ 1 ][ "body" ][ "name" ] == "shortcut2"
420+ finally :
421+ constants . FEATURE_FLAG . discard ( "enable_shortcut_smart_diff" )
419422
420423
421424def test_shortcut_smart_diff_publishes_client_side_new_field (
422- mock_fabric_workspace , mock_item , restore_feature_flags
425+ mock_fabric_workspace , mock_item
423426):
424427 """Smart diff should publish when repo contains a new field missing from deployed shortcut."""
425428 shortcuts_data = [
@@ -440,17 +443,19 @@ def test_shortcut_smart_diff_publishes_client_side_new_field(
440443
441444 mock_item .item_files = [create_shortcut_file (shortcuts_data )]
442445 set_deployed_shortcuts (mock_fabric_workspace , deployed_shortcuts )
443- constants .FEATURE_FLAG .add (FeatureFlag . ENABLE_SHORTCUT_SMART_DIFF . value )
444-
445- ShortcutPublisher (mock_fabric_workspace , mock_item ).publish_all ()
446+ constants .FEATURE_FLAG .add ("enable_shortcut_smart_diff" )
447+ try :
448+ ShortcutPublisher (mock_fabric_workspace , mock_item ).publish_all ()
446449
447- post_calls = get_shortcut_post_calls (mock_fabric_workspace )
448- assert len (post_calls ) == 1
449- assert post_calls [0 ][1 ]["body" ]["name" ] == "shortcut1"
450+ post_calls = get_shortcut_post_calls (mock_fabric_workspace )
451+ assert len (post_calls ) == 1
452+ assert post_calls [0 ][1 ]["body" ]["name" ] == "shortcut1"
453+ finally :
454+ constants .FEATURE_FLAG .discard ("enable_shortcut_smart_diff" )
450455
451456
452457def test_shortcut_smart_diff_disabled_keeps_publish_all_behavior (
453- mock_fabric_workspace , mock_item , restore_feature_flags
458+ mock_fabric_workspace , mock_item
454459):
455460 """When smart diff is disabled, unchanged shortcuts are still published."""
456461 shortcuts_data = [
0 commit comments