Skip to content

Commit d54cdf4

Browse files
further bug fixes
1 parent f441f22 commit d54cdf4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

choose_l10n_ci_set.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def valid_l10n_mappings():
2121
Returns:
2222
The dictionary of valid l10n mappings.
2323
"""
24-
mapping = defaultdict(list)
24+
mapping = defaultdict(set)
2525
region_paths = [d for d in os.listdir("./l10n_CM/region/")]
2626
for region_path in region_paths:
2727
if region_path != "Unified.json":
@@ -30,7 +30,7 @@ def valid_l10n_mappings():
3030
region_file = json.load(f)
3131
if region_file.get("sites"):
3232
for site in region_file.get("sites"):
33-
mapping[site].append(region)
33+
mapping[site].add(region)
3434
return mapping
3535

3636

@@ -52,14 +52,14 @@ def process_changed_file(f, selected_mappings):
5252
region_path = os.path.join("l10n_CM", "region", f"{region}.json")
5353
# make sure the region mapping file exists before adding the mapping
5454
if os.path.exists(region_path):
55-
selected_mappings[site].append(region)
55+
selected_mappings[site].add(region)
5656
elif f.startswith(os.path.join("l10n_CM", "region")):
5757
# if a region file is changed, add the region to each site mapping.
5858
region = split[-1].split(".")[0]
5959
with open(f, "r+") as f:
6060
region_file = json.load(f)
6161
for site in region_file.get("sites", []):
62-
selected_mappings[site].append(region)
62+
selected_mappings[site].add(region)
6363

6464

6565
def save_mappings(selected_container):
@@ -89,7 +89,8 @@ def select_l10n_mappings(beta_version):
8989
beta_split = (beta_version % 3) + 1
9090
if os.path.exists(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json"):
9191
with open(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json", "r") as f:
92-
return json.load(f)
92+
current_split_mappings = {k: set(v) for k, v in json.load(f).items()}
93+
return current_split_mappings
9394
else:
9495
return valid_l10n_mappings()
9596

@@ -169,7 +170,7 @@ def select_l10n_mappings(beta_version):
169170
)
170171
main_conftest = "conftest.py"
171172
base_page = os.path.join("modules", "page_base.py")
172-
selected_mappings = defaultdict(list)
173+
selected_mappings = defaultdict(set)
173174
if main_conftest in committed_files or base_page in committed_files:
174175
# Run sample tests for all mappings if main conftest or basepage changed
175176
selected_mappings |= sample_mappings

l10n_CM/region/US.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"walmart",
66
"lowes",
77
"etsy",
8+
"calvinklein",
89
"bestbuy",
910
"demo",
1011
"newegg",
1112
"aldoshoes",
1213
"apple",
13-
"wish",
14-
"calvinklein"
14+
"wish"
1515
],
1616
"tests": []
1717
}

0 commit comments

Comments
 (0)