19
19
LOCALHOST = "127.0.0.1"
20
20
PORT = 8080
21
21
22
- logging .basicConfig (level = logging .INFO )
23
-
24
22
25
23
class MyHttpRequestHandler (SimpleHTTPRequestHandler ):
26
24
live_site = None
@@ -88,7 +86,7 @@ def run_tests(reg, site, flg, all_tests):
88
86
os .environ ["FX_REGION" ] = reg
89
87
subprocess .run (["pytest" , * flg , * all_tests ], check = True , text = True )
90
88
else :
91
- logging .info (f"{ reg } has no tests." )
89
+ logging .info (f"{ reg } region on { site } site has no tests." )
92
90
except subprocess .CalledProcessError as e :
93
91
logging .warning (f"Test run failed. { e } " )
94
92
@@ -175,8 +173,18 @@ def run_unified(regions, unified_flags):
175
173
run_tests (unified_region , live_site , unified_flags , unified_tests )
176
174
else :
177
175
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
+ )
180
188
181
189
182
190
if __name__ == "__main__" :
@@ -198,10 +206,12 @@ def run_unified(regions, unified_flags):
198
206
# for a given site, run all region specific tests.
199
207
for region in arguments :
200
208
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 )
201
211
logging .info (f"Running Specific Tests for { region } ." )
202
212
# If the live_site is 'demo', skip starting the server
203
213
if site == "demo" :
204
214
run_tests (region , site , flags , tests )
205
- else :
215
+ elif os . path . exists ( json_path ) :
206
216
with running_server (site , region ):
207
217
run_tests (region , site , flags , tests )
0 commit comments