Skip to content

Commit f3774b6

Browse files
remove loggin
1 parent 4817d35 commit f3774b6

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

l10n_CM/run_l10n.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
LOCALHOST = "127.0.0.1"
2020
PORT = 8080
2121

22-
logging.basicConfig(level=logging.INFO)
23-
2422

2523
class MyHttpRequestHandler(SimpleHTTPRequestHandler):
2624
live_site = None
@@ -88,7 +86,7 @@ def run_tests(reg, site, flg, all_tests):
8886
os.environ["FX_REGION"] = reg
8987
subprocess.run(["pytest", *flg, *all_tests], check=True, text=True)
9088
else:
91-
logging.info(f"{reg} has no tests.")
89+
logging.info(f"{reg} region on {site} site has no tests.")
9290
except subprocess.CalledProcessError as e:
9391
logging.warning(f"Test run failed. {e}")
9492

@@ -175,8 +173,18 @@ def run_unified(regions, unified_flags):
175173
run_tests(unified_region, live_site, unified_flags, unified_tests)
176174
else:
177175
for unified_region in regions:
178-
with running_server(live_site, unified_region):
179-
run_tests(unified_region, live_site, unified_flags, unified_tests)
176+
unified_json_path = os.path.join(
177+
current_dir, "constants", live_site, unified_region
178+
)
179+
if os.path.exists(unified_json_path):
180+
with running_server(live_site, unified_region):
181+
run_tests(
182+
unified_region, live_site, unified_flags, unified_tests
183+
)
184+
else:
185+
logging.info(
186+
f"No mapping json file for {unified_region} region and {live_site} site."
187+
)
180188

181189

182190
if __name__ == "__main__":
@@ -198,10 +206,12 @@ def run_unified(regions, unified_flags):
198206
# for a given site, run all region specific tests.
199207
for region in arguments:
200208
tests = get_region_tests(region)
209+
# Check if field mapping json file is present, pass test region if it isn't
210+
json_path = os.path.join(current_dir, "constants", site, region)
201211
logging.info(f"Running Specific Tests for {region}.")
202212
# If the live_site is 'demo', skip starting the server
203213
if site == "demo":
204214
run_tests(region, site, flags, tests)
205-
else:
215+
elif os.path.exists(json_path):
206216
with running_server(site, region):
207217
run_tests(region, site, flags, tests)

0 commit comments

Comments
 (0)