@@ -53,15 +53,18 @@ def process_changed_file(f, selected_mappings):
5353 selected_mappings: the selected mappings dictionary (updated in place).
5454 """
5555 split = f .split (SLASH )
56- if f .startswith ("l10n_CM/sites/" ) or f .startswith ("l10n_CM/constants/" ):
56+
57+ if f .startswith (os .path .join ("l10n_CM" , "sites" )) or f .startswith (
58+ os .path .join ("l10n_CM" , "constants" )
59+ ):
5760 # if constants or sites are changed, add a single site/region mapping entry.
5861 site = split [2 ]
5962 region = split [3 ]
6063 region_path = os .path .join ("l10n_CM" , "region" , f"{ region } .json" )
6164 # make sure the region mapping file exists before adding the mapping
6265 if os .path .exists (region_path ):
6366 selected_mappings [site ].add (region )
64- elif f .startswith ("l10n_CM/ region/" ):
67+ elif f .startswith (os . path . join ( "l10n_CM" , " region" ) ):
6568 # if a region file is changed, add the region to each site mapping.
6669 region = split [- 1 ].split ("." )[0 ]
6770 with open (f , "r+" ) as f :
@@ -128,24 +131,22 @@ def process_changed_file(f, selected_mappings):
128131 )
129132 main_conftest = "conftest.py"
130133 base_page = os .path .join ("modules" , "page_base.py" )
131-
134+ selected_mappings = defaultdict ( set )
132135 if main_conftest in committed_files or base_page in committed_files :
133136 # Run sample tests for all mappings if main conftest or basepage changed
134- add_selected_mappings (sample_mappings )
135- sys .exit (0 )
137+ selected_mappings |= sample_mappings
136138
137139 # Run sample tests for all mappings if any core l10n model, component, conftest, or tests are changed.
138- selected_mappings = defaultdict (set )
139140 for f in committed_files :
140- for re_val in re_set_all :
141- if re_val .match (f ):
142- add_selected_mappings (sample_mappings )
143- sys .exit (0 )
144141 # check if constants, sites or region directory files were changed or added.
145142 # if so, add the site/region mappings.
146143 for re_val in re_set_select :
147144 if re_val .match (f ):
148145 process_changed_file (f , selected_mappings )
146+ for re_val in re_set_all :
147+ if re_val .match (f ):
148+ selected_mappings |= sample_mappings
149+ break
149150
150151 add_selected_mappings (selected_mappings )
151152 sys .exit (0 )
0 commit comments