2121def run_test_script (script_name , env ):
2222 """Run a single test script with the specified environment."""
2323 script_path = os .path .join (os .path .dirname (__file__ ), script_name )
24-
24+
2525 print (f"\n { '=' * 80 } " )
2626 print (f"Running { script_name } " )
2727 print (f"{ '=' * 80 } " )
28-
28+
2929 try :
3030 # Run the script with the same environment argument
31- result = subprocess .run ([
32- sys .executable , script_path , '--env' , env
33- ], capture_output = False , text = True , check = False )
34-
31+ result = subprocess .run (
32+ [sys .executable , script_path , "--env" , env ],
33+ capture_output = False ,
34+ text = True ,
35+ check = False ,
36+ )
37+
3538 if result .returncode == 0 :
3639 print (f"✅ { script_name } passed" )
3740 return True
3841 else :
39- print (f"❌ { script_name } failed with exit code { result .returncode } " )
42+ print (
43+ f"❌ { script_name } failed with exit code { result .returncode } "
44+ )
4045 return False
41-
46+
4247 except Exception as e :
4348 print (f"❌ Error running { script_name } : { e } " )
4449 return False
@@ -47,50 +52,53 @@ def run_test_script(script_name, env):
4752def main ():
4853 """Main function to run all integration tests."""
4954 args = parse_test_args ()
50-
55+
5156 print ("🚀 Running All Integration Tests" )
5257 print (f"Environment: { 'Production' if args .env == 'prod' else 'Local' } " )
53-
54- target_url = ('https://metadata-portal.allenneuraldynamics-test.org'
55- if args .env == 'prod' else 'http://localhost:5006' )
58+
59+ target_url = (
60+ "https://metadata-portal.allenneuraldynamics-test.org"
61+ if args .env == "prod"
62+ else "http://localhost:5006"
63+ )
5664 print (f"Target URL: { target_url } " )
57-
65+
5866 # List of test scripts to run
5967 test_scripts = [
60- ' test_200.py' ,
61- ' test_400.py' ,
62- ' test_individual_fields.py' ,
63- ' test_files_endpoint.py' ,
64- ' test_gather_integration.py'
68+ " test_200.py" ,
69+ " test_400.py" ,
70+ " test_individual_fields.py" ,
71+ " test_files_endpoint.py" ,
72+ " test_gather_integration.py" ,
6573 ]
66-
74+
6775 results = []
68-
76+
6977 # Run each test script
7078 for script in test_scripts :
7179 success = run_test_script (script , args .env )
7280 results .append ((script , success ))
73-
81+
7482 # Print summary
7583 print (f"\n { '=' * 80 } " )
7684 print ("TEST SUMMARY" )
7785 print (f"{ '=' * 80 } " )
78-
86+
7987 passed = 0
8088 failed = 0
81-
89+
8290 for script , success in results :
8391 status = "✅ PASSED" if success else "❌ FAILED"
8492 print (f"{ script :<30} { status } " )
8593 if success :
8694 passed += 1
8795 else :
8896 failed += 1
89-
97+
9098 print (f"\n Total: { len (results )} tests" )
9199 print (f"Passed: { passed } " )
92100 print (f"Failed: { failed } " )
93-
101+
94102 if failed == 0 :
95103 print ("\n 🎉 All tests passed!" )
96104 sys .exit (0 )
0 commit comments