11
11
from connector_ops import required_reviewer_checks
12
12
13
13
14
- @pytest .fixture
14
+ # This fixture ensure that the remote CI works the same way local CI does
15
+ @pytest .fixture (autouse = True )
15
16
def mock_diffed_branched (mocker ):
16
17
airbyte_repo = git .Repo (search_parent_directories = True )
17
18
mocker .patch .object (required_reviewer_checks .utils , "DIFFED_BRANCH" , airbyte_repo .active_branch )
@@ -57,6 +58,7 @@ def not_strategic_test_strictness_level_change_expected_team(tmp_path, pokeapi_a
57
58
58
59
@pytest .fixture
59
60
def not_strategic_bypass_reason_file_change_expected_team (tmp_path , pokeapi_acceptance_test_config_path ):
61
+ # The bypass reason logic explicitly only checks for bypass reasons on strategic connectors
60
62
expected_teams = []
61
63
backup_path = tmp_path / "non_strategic_acceptance_test_config.backup"
62
64
shutil .copyfile (pokeapi_acceptance_test_config_path , backup_path )
@@ -90,7 +92,9 @@ def strategic_connector_file_change_expected_team(tmp_path, strategic_connector_
90
92
91
93
@pytest .fixture
92
94
def strategic_connector_backward_compatibility_file_change_expected_team (tmp_path , strategic_connector_file ):
93
- expected_teams = list (required_reviewer_checks .BACKWARD_COMPATIBILITY_REVIEWERS )
95
+ expected_teams = list (
96
+ required_reviewer_checks .STRATEGIC_PYTHON_CONNECTOR_REVIEWERS .union (required_reviewer_checks .BACKWARD_COMPATIBILITY_REVIEWERS )
97
+ )
94
98
backup_path = tmp_path / "strategic_acceptance_test_config.backup"
95
99
shutil .copyfile (strategic_connector_file , backup_path )
96
100
with open (strategic_connector_file , "a" ) as strategic_acceptance_test_config_file :
@@ -101,7 +105,9 @@ def strategic_connector_backward_compatibility_file_change_expected_team(tmp_pat
101
105
102
106
@pytest .fixture
103
107
def strategic_connector_bypass_reason_file_change_expected_team (tmp_path , strategic_connector_file ):
104
- expected_teams = list (required_reviewer_checks .BYPASS_REASON_REVIEWERS )
108
+ expected_teams = list (
109
+ required_reviewer_checks .STRATEGIC_PYTHON_CONNECTOR_REVIEWERS .union (required_reviewer_checks .BYPASS_REASON_REVIEWERS )
110
+ )
105
111
backup_path = tmp_path / "strategic_acceptance_test_config.backup"
106
112
shutil .copyfile (strategic_connector_file , backup_path )
107
113
with open (strategic_connector_file , "a" ) as strategic_acceptance_test_config_file :
@@ -112,7 +118,9 @@ def strategic_connector_bypass_reason_file_change_expected_team(tmp_path, strate
112
118
113
119
@pytest .fixture
114
120
def strategic_connector_test_strictness_level_file_change_expected_team (tmp_path , strategic_connector_file ):
115
- expected_teams = list (required_reviewer_checks .TEST_STRICTNESS_LEVEL_REVIEWERS )
121
+ expected_teams = list (
122
+ required_reviewer_checks .STRATEGIC_PYTHON_CONNECTOR_REVIEWERS .union (required_reviewer_checks .TEST_STRICTNESS_LEVEL_REVIEWERS )
123
+ )
116
124
backup_path = tmp_path / "strategic_acceptance_test_config.backup"
117
125
shutil .copyfile (strategic_connector_file , backup_path )
118
126
with open (strategic_connector_file , "a" ) as strategic_acceptance_test_config_file :
@@ -145,7 +153,8 @@ def verify_requirements_file_was_generated(captured: str):
145
153
def verify_review_requirements_file_contains_expected_teams (requirements_file_path : str , expected_teams : List ):
146
154
with open (requirements_file_path , "r" ) as requirements_file :
147
155
requirements = yaml .safe_load (requirements_file )
148
- assert any ([r ["teams" ] == expected_teams for r in requirements ])
156
+ all_required_teams = set ().union (* (r ["teams" ] for r in requirements ))
157
+ assert all_required_teams == set (expected_teams )
149
158
150
159
151
160
def check_review_requirements_file (capsys , expected_teams : List ):
@@ -159,49 +168,41 @@ def check_review_requirements_file(capsys, expected_teams: List):
159
168
verify_review_requirements_file_contains_expected_teams (requirements_file_path , expected_teams )
160
169
161
170
162
- def test_find_mandatory_reviewers_backward_compatibility (
163
- mock_diffed_branched , capsys , not_strategic_backward_compatibility_change_expected_team
164
- ):
171
+ def test_find_mandatory_reviewers_backward_compatibility (capsys , not_strategic_backward_compatibility_change_expected_team ):
165
172
check_review_requirements_file (capsys , not_strategic_backward_compatibility_change_expected_team )
166
173
167
174
168
- def test_find_mandatory_reviewers_test_strictness_level (
169
- mock_diffed_branched , capsys , not_strategic_test_strictness_level_change_expected_team
170
- ):
175
+ def test_find_mandatory_reviewers_test_strictness_level (capsys , not_strategic_test_strictness_level_change_expected_team ):
171
176
check_review_requirements_file (capsys , not_strategic_test_strictness_level_change_expected_team )
172
177
173
178
174
- def test_find_mandatory_reviewers_not_strategic_bypass_reason (
175
- mock_diffed_branched , capsys , not_strategic_bypass_reason_file_change_expected_team
176
- ):
179
+ def test_find_mandatory_reviewers_not_strategic_bypass_reason (capsys , not_strategic_bypass_reason_file_change_expected_team ):
177
180
check_review_requirements_file (capsys , not_strategic_bypass_reason_file_change_expected_team )
178
181
179
182
180
- def test_find_mandatory_reviewers_ga (mock_diffed_branched , capsys , strategic_connector_file_change_expected_team ):
183
+ def test_find_mandatory_reviewers_ga (capsys , strategic_connector_file_change_expected_team ):
181
184
check_review_requirements_file (capsys , strategic_connector_file_change_expected_team )
182
185
183
186
184
187
def test_find_mandatory_reviewers_strategic_backward_compatibility (
185
- mock_diffed_branched , capsys , strategic_connector_backward_compatibility_file_change_expected_team
188
+ capsys , strategic_connector_backward_compatibility_file_change_expected_team
186
189
):
187
190
check_review_requirements_file (capsys , strategic_connector_backward_compatibility_file_change_expected_team )
188
191
189
192
190
- def test_find_mandatory_reviewers_strategic_bypass_reason (
191
- mock_diffed_branched , capsys , strategic_connector_bypass_reason_file_change_expected_team
192
- ):
193
+ def test_find_mandatory_reviewers_strategic_bypass_reason (capsys , strategic_connector_bypass_reason_file_change_expected_team ):
193
194
check_review_requirements_file (capsys , strategic_connector_bypass_reason_file_change_expected_team )
194
195
195
196
196
197
def test_find_mandatory_reviewers_strategic_test_strictness_level (
197
- mock_diffed_branched , capsys , strategic_connector_test_strictness_level_file_change_expected_team
198
+ capsys , strategic_connector_test_strictness_level_file_change_expected_team
198
199
):
199
200
check_review_requirements_file (capsys , strategic_connector_test_strictness_level_file_change_expected_team )
200
201
201
202
202
- def test_find_mandatory_reviewers_breaking_change_release (mock_diffed_branched , capsys , test_breaking_change_release_expected_team ):
203
+ def test_find_mandatory_reviewers_breaking_change_release (capsys , test_breaking_change_release_expected_team ):
203
204
check_review_requirements_file (capsys , test_breaking_change_release_expected_team )
204
205
205
206
206
- def test_find_mandatory_reviewers_no_tracked_changed (mock_diffed_branched , capsys , not_strategic_not_tracked_change_expected_team ):
207
+ def test_find_mandatory_reviewers_no_tracked_changed (capsys , not_strategic_not_tracked_change_expected_team ):
207
208
check_review_requirements_file (capsys , not_strategic_not_tracked_change_expected_team )
0 commit comments