@@ -476,3 +476,52 @@ 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 len (plan .environment .promoted_snapshot_ids ) == len (all_snapshots )
496+
497+ context .apply (plan )
498+
499+ data_objs = context .engine_adapter .get_data_objects ("sushi__dev" )
500+ assert len (data_objs ) == len (all_snapshots )
501+
502+
503+ @time_machine .travel ("2023-01-08 15:00:00 UTC" )
504+ def test_select_models_with_include_unmodified (init_and_plan_context : t .Callable ):
505+ context , plan = init_and_plan_context ("examples/sushi" )
506+ context .apply (plan )
507+
508+ plan = context .plan_builder (
509+ "dev" ,
510+ select_models = ["*top_waiters" , "*customer_revenue_by_day" ],
511+ include_unmodified = True ,
512+ skip_tests = True ,
513+ ).build ()
514+
515+ assert len (plan .environment .snapshots ) == len (context .snapshots )
516+
517+ promoted_set = {s_id .name for s_id in plan .environment .promoted_snapshot_ids }
518+ assert promoted_set == {
519+ '"memory"."sushi"."customer_revenue_by_day"' ,
520+ '"memory"."sushi"."top_waiters"' ,
521+ }
522+
523+ context .apply (plan )
524+
525+ data_objs = context .engine_adapter .get_data_objects ("sushi__dev" )
526+ assert len (data_objs ) == 2
527+ assert {o .name for o in data_objs } == {"customer_revenue_by_day" , "top_waiters" }
0 commit comments