77specification_hash = "ebe620f5228d01170b1857bad3e738aa432f5fd6"
88collection_hash = "ed4c5979268ad880f7edbdc2047cfcfa6b9ee3b4"
99pipeline_hash = "4a5a778d678db812e4f3d498a5aaa6f39af38d10"
10+ resource_hash = "063e908c6695671063dee27c534bf3471aa3f5d5"
1011
1112
1213def get_code_hash ():
@@ -26,6 +27,8 @@ def test_state(tmp_path):
2627 specification_dir = os .path .join (test_data_dir , "specification" ),
2728 collection_dir = os .path .join (test_data_dir , "collection" ),
2829 pipeline_dir = os .path .join (test_data_dir , "pipeline" ),
30+ resource_dir = os .path .join (test_data_dir , "resource" ),
31+ incremental_override = True ,
2932 output_path = state_path ,
3033 )
3134
@@ -36,18 +39,24 @@ def test_state(tmp_path):
3639 "code" ,
3740 "specification" ,
3841 "collection" ,
42+ "resource" ,
3943 "pipeline" ,
44+ "incremental_override" ,
4045 ]
4146 assert state_data ["code" ] == get_code_hash ()
4247 assert state_data ["specification" ] == specification_hash
4348 assert state_data ["collection" ] == collection_hash
4449 assert state_data ["pipeline" ] == pipeline_hash
50+ assert state_data ["resource" ] == resource_hash
51+ assert state_data ["incremental_override" ]
4552
4653 assert (
4754 compare_state (
4855 specification_dir = os .path .join (test_data_dir , "specification" ),
4956 collection_dir = os .path .join (test_data_dir , "collection" ),
5057 pipeline_dir = os .path .join (test_data_dir , "pipeline" ),
58+ resource_dir = os .path .join (test_data_dir , "resource" ),
59+ incremental_override = True ,
5160 state_path = state_path ,
5261 )
5362 is None
@@ -58,6 +67,8 @@ def test_state(tmp_path):
5867 specification_dir = os .path .join (test_data_dir , "specification" ),
5968 collection_dir = os .path .join (test_data_dir , "collection_exclude" ),
6069 pipeline_dir = os .path .join (test_data_dir , "pipeline" ),
70+ resource_dir = os .path .join (test_data_dir , "resource" ),
71+ incremental_override = True ,
6172 state_path = state_path ,
6273 )
6374 is None
@@ -67,5 +78,30 @@ def test_state(tmp_path):
6778 specification_dir = os .path .join (test_data_dir , "specification" ),
6879 collection_dir = os .path .join (test_data_dir , "collection_blank" ),
6980 pipeline_dir = os .path .join (test_data_dir , "pipeline" ),
81+ resource_dir = os .path .join (test_data_dir , "resource" ),
82+ incremental_override = True ,
7083 state_path = state_path ,
7184 ) == ["collection" ]
85+
86+ assert compare_state (
87+ specification_dir = os .path .join (test_data_dir , "specification" ),
88+ collection_dir = os .path .join (test_data_dir , "collection" ),
89+ pipeline_dir = os .path .join (test_data_dir , "pipeline" ),
90+ resource_dir = os .path .join (test_data_dir , "resource_diff" ),
91+ incremental_override = True ,
92+ state_path = state_path ,
93+ ) == ["resource" ]
94+
95+ # we shouldn't include the incremental override value in state comparison
96+ # so test it isn't flagged if different
97+ assert (
98+ compare_state (
99+ specification_dir = os .path .join (test_data_dir , "specification" ),
100+ collection_dir = os .path .join (test_data_dir , "collection" ),
101+ pipeline_dir = os .path .join (test_data_dir , "pipeline" ),
102+ resource_dir = os .path .join (test_data_dir , "resource" ),
103+ incremental_override = False ,
104+ state_path = state_path ,
105+ )
106+ is None
107+ )
0 commit comments