@@ -476,3 +476,54 @@ def test_create_environment_no_changes_with_selector(init_and_plan_context: t.Ca
476476
477477 schema_objects = context .engine_adapter .get_data_objects ("sushi__dev" )
478478 assert {o .name for o in schema_objects } == {"top_waiters" }
479+
480+
481+ @time_machine .travel ("2023-01-08 15:00:00 UTC" )
482+ def test_include_unmodified (init_and_plan_context : t .Callable ):
483+ context , plan = init_and_plan_context ("examples/sushi" )
484+ context .apply (plan )
485+
486+ plan = context .plan_builder (
487+ "dev" ,
488+ include_unmodified = True ,
489+ skip_tests = True ,
490+ ).build ()
491+
492+ all_snapshots = context .snapshots
493+
494+ assert len (plan .environment .snapshots ) == len (all_snapshots )
495+ assert plan .environment .promoted_snapshot_ids is None
496+
497+ context .apply (plan )
498+
499+ data_objs = context .engine_adapter .get_data_objects ("sushi__dev" )
500+ assert len (data_objs ) == len (
501+ [s for s in all_snapshots .values () if s .is_model and not s .is_symbolic ]
502+ )
503+
504+
505+ @time_machine .travel ("2023-01-08 15:00:00 UTC" )
506+ def test_select_models_with_include_unmodified (init_and_plan_context : t .Callable ):
507+ context , plan = init_and_plan_context ("examples/sushi" )
508+ context .apply (plan )
509+
510+ plan = context .plan_builder (
511+ "dev" ,
512+ select_models = ["*top_waiters" , "*customer_revenue_by_day" ],
513+ include_unmodified = True ,
514+ skip_tests = True ,
515+ ).build ()
516+
517+ assert len (plan .environment .snapshots ) == len (context .snapshots )
518+
519+ promoted_set = {s_id .name for s_id in plan .environment .promoted_snapshot_ids }
520+ assert promoted_set == {
521+ '"memory"."sushi"."customer_revenue_by_day"' ,
522+ '"memory"."sushi"."top_waiters"' ,
523+ }
524+
525+ context .apply (plan )
526+
527+ data_objs = context .engine_adapter .get_data_objects ("sushi__dev" )
528+ assert len (data_objs ) == 2
529+ assert {o .name for o in data_objs } == {"customer_revenue_by_day" , "top_waiters" }
0 commit comments