1+ import subprocess
2+ import sys
3+
14import yaml
2- import subprocess , sys
35
46# developers can use this tool to verify all repo workflow test execute to completion
57#
@@ -19,38 +21,49 @@ def has_key_path(d, key_path, separator="."):
1921 d = d [key ]
2022 return True
2123
24+
2225# Load the workflow file
23- with open (' .github/workflows/test.yml' , 'r' ) as file :
26+ with open (" .github/workflows/test.yml" ) as file :
2427 workflow = yaml .safe_load (file )
2528
26- tests_total = 0
27- tests_skipped = 0
28- tests_completed = 0
29+ tests_total = 0
30+ tests_skipped = 0
31+ tests_completed = 0
2932
30- for job_name , job_details in workflow .get ("jobs" , {}).items ():
33+ for job_details in workflow .get ("jobs" , {}).values ():
3134 if has_key_path (job_details , "strategy.matrix.test" ):
3235 print ("Found test strategy job, starting serial execution of each test" )
3336 tests = job_details ["strategy" ]["matrix" ]["test" ]
34-
37+
3538 for test in tests :
36- tests_total += 1
39+ tests_total += 1
3740 if len (sys .argv ) > 1 and sys .argv [1 ] not in test :
38- print ("skipping test as requested:" ,test )
39- tests_skipped += 1
41+ print ("skipping test as requested:" , test )
42+ tests_skipped += 1
4043 continue
4144 command = f"python test/{ test } "
42- print ("###################################################################################################" )
45+ print (
46+ "###################################################################################################"
47+ )
4348 print ("############## executing:" , command )
44- print ("###################################################################################################" )
49+ print (
50+ "###################################################################################################"
51+ )
4552 process = subprocess .run (command , shell = True )
4653 if process .returncode != 0 :
4754 print ("******** testing failed" )
48- if process .stdout : print ("stdout:" , process .stdout )
49- if process .stderr : print ("stderr:" , process .stderr )
55+ if process .stdout :
56+ print ("stdout:" , process .stdout )
57+ if process .stderr :
58+ print ("stderr:" , process .stderr )
5059 sys .exit (1 )
51- tests_completed += 1
60+ tests_completed += 1
5261
53- print ("###################################################################################################" )
62+ print (
63+ "###################################################################################################"
64+ )
5465print ("testing complete" )
5566print (f"{ tests_completed } of { tests_total } complete - skipped: { tests_skipped } tests" )
56- print ("###################################################################################################" )
67+ print (
68+ "###################################################################################################"
69+ )
0 commit comments