@@ -36,26 +36,31 @@ def valid_l10n_mappings():
3636
3737def distribute_mappings_evenly (mappings , version ):
3838 """
39- Write the selected mappings to the output file .
39+ Distribute the selected mappings if its a reportable run .
4040
4141 Args:
4242 mappings (dict): A dictionary of mappings, where the keys are sites and the values are sets of regions.
4343 version (int): The beta_version of the beta.
4444 """
4545 if not mappings :
4646 return {}
47- # sort the mappings by the length of the regions per site
48- mappings = dict (sorted (mappings .items (), key = lambda val : len (val [1 ]), reverse = True ))
49- # place the mappings into 3 containers evenly according to the load
50- loads = [0 , 0 , 0 ]
51- containers = [defaultdict (set ) for _ in range (3 )]
52- for key , value in mappings .items ():
53- min_idx = loads .index (min (loads ))
54- containers [min_idx ][key ] = value
55- loads [min_idx ] += len (value )
56- # get container index according to beta beta_version
57- run_idx = version % 3
58- return containers [run_idx ]
47+ if os .environ .get ("TESTRAIL_REPORT" ):
48+ # sort the mappings by the length of the regions per site
49+ mappings = dict (
50+ sorted (mappings .items (), key = lambda val : len (val [1 ]), reverse = True )
51+ )
52+ # place the mappings into 3 containers evenly according to the load
53+ loads = [0 , 0 , 0 ]
54+ containers = [defaultdict (set ) for _ in range (3 )]
55+ for key , value in mappings .items ():
56+ min_idx = loads .index (min (loads ))
57+ containers [min_idx ][key ] = value
58+ loads [min_idx ] += len (value )
59+ # get container index according to beta beta_version
60+ run_idx = version % 3
61+ return containers [run_idx ]
62+ else :
63+ return mappings
5964
6065
6166def process_changed_file (f , selected_mappings ):
0 commit comments