Skip to content

Commit

Permalink
hard code list for python3
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Oct 10, 2017
1 parent a08581d commit e890236
Showing 1 changed file with 49 additions and 17 deletions.
66 changes: 49 additions & 17 deletions scripts/tests/list_tests
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
#!/usr/bin/env python

# This script will print the list of test classes in
# scripts_regression_tests.py, however discover doesnt seem to work
# correctly in python3 so the list is hard coded.
# When run in python2 the hard coded list is checked for correctness.
#
import unittest
import sys
DEBUG = False

#pylint: disable=protected-access
def list_tests_from():
loader = unittest.TestLoader()
suite = loader.discover(".", pattern="scripts_regression_tests.py")
test_classes = []
for alltests in suite:
tests = alltests._tests
if len(tests):
for atest in tests:
if DEBUG:
print(atest)
for btest in atest._tests:
btestname = btest.__str__().split()
test_classes.append(btestname[1][1:-1].split('.')[1])
# add this explicitly, not captured by the above
test_classes.append("B_CheckCode")
for ctest in sorted(list(set(test_classes))):
print(ctest)
test_classes_hard = hard_coded_list()
if sys.hexversion < 0x03000000:
loader = unittest.TestLoader()
suite = loader.discover(".", pattern="scripts_regression_tests.py")
test_classes = []
for alltests in suite:
tests = alltests._tests
if len(tests):
for atest in tests:
if DEBUG:
print(atest)
for btest in atest._tests:
btestname = btest.__str__().split()
test_classes.append(btestname[1][1:-1].split('.')[1])
# add this explicitly, not captured by the above
test_classes.append("B_CheckCode")
if set(test_classes) != set(test_classes_hard):
print ("Error: hard coded test_class list out of sync with actual, please fix")
test_classes_hard = test_classes

for ctest in sorted(list(set(test_classes_hard))):
print(ctest)

def hard_coded_list():
return ('A_RunUnitTests',
'B_CheckCode',
'G_TestMacrosBasic',
'H_TestMakeMacros',
'I_TestCMakeMacros',
'J_TestCreateNewcase',
'K_TestCimeCase',
'L_TestSaveTimings',
'M_TestWaitForTests',
'N_TestUnitTest',
'O_TestTestScheduler',
'P_TestJenkinsGenericJob',
'Q_TestBlessTestResults',
'S_TestManageAndQuery',
'T_TestRunRestart',
'X_TestSingleSubmit',
'Z_FullSystemTest')



if __name__ == "__main__":
# Include the directories
Expand Down

0 comments on commit e890236

Please sign in to comment.