casatestutils/runtest.py

Modified
1024 1024 with open("{}/{}".format(_.__path__[0], "component_to_test_map.json")) as ctt:
1025 1025 component_to_test_map = json.load(ctt)
1026 1026 except:
1027 1027 print("No JSON file to Map")
1028 1028 no_test_components = []
1029 1029 for c in components:
1030 1030 _isComponent = False
1031 1031 component = c.strip()
1032 1032 for myDict in component_to_test_map["testlist"]:
1033 1033 #print(component, myDict["testGroup"])
1034 - if component in myDict["testGroup"]:
1034 + if component in myDict["testGroup"] or component in myDict["testType"]:
1035 1035 _isComponent = True
1036 1036 if myDict["testScript"] not in testnames: testnames.append(myDict["testScript"])
1037 1037 if not _isComponent:
1038 1038 print("No Tests for Component: {}".format(component))
1039 1039 no_test_components.append(component)
1040 +
1040 1041 if (len(no_test_components) > 0) and (len(testnames)==0):
1041 1042 print("No Test Suite for Component(s): {} Using Component 'default'".format(no_test_components))
1042 1043 component = 'default'
1043 1044 for myDict in component_to_test_map["testlist"]:
1044 1045 if component in myDict["testGroup"]:
1045 1046 _isComponent = True
1046 1047 testnames.append(myDict["testScript"])
1047 1048
1048 1049 if args.verbose:
1049 1050 verbose = True
1074 1075 except:
1075 1076 raise Exception(" The list should contain one test per line.")
1076 1077
1077 1078 if args.branch is not None:
1078 1079 JIRA_BRANCH = args.branch
1079 1080
1080 1081
1081 1082 if args.test_paths is not None:
1082 1083 test_paths = [x.strip() for x in args.test_paths.split(',')]
1083 1084
1085 + temp_storage = []
1084 1086 for arg in unknownArgs:
1085 1087 if arg.startswith(("-", "--")):
1086 1088 raise ValueError('unrecognized argument: %s'%(arg))
1087 1089 sys.exit()
1088 1090 else:
1089 - tests = [x.strip() for x in arg.split(",")]
1091 + if '[' in arg:
1092 + tests = [x.strip() for x in arg.split("],")]
1093 + for i in range(len(tests)):
1094 + test = tests[i]
1095 + if '[' in test and not test.endswith("]"):
1096 + tests[i] = tests[i] + "]"
1097 + for i in range(len(tests)):
1098 + test = tests[i]
1099 + #print(tests)
1100 + if test.find(",") < test.find('['):
1101 + temp_storage = temp_storage + test.split(',',1)
1102 + else:
1103 + temp_storage.append(test)
1104 + tests = temp_storage
1105 + else:
1106 + tests = [x.strip() for x in arg.split(",")]
1090 1107 for test in tests:
1091 1108 try:
1092 1109 testcases = None
1093 1110 # Check if testcases are provided
1094 1111 if "[" in test:
1095 1112 listarray = test.split("[")
1096 1113 if not listarray[0].endswith(".py"):
1097 1114 testnames.append(test)
1098 1115 else:
1099 1116 test = listarray[0]
1168 1185 indices = []
1169 1186 for i, t in enumerate(testnames):
1170 1187 if t.split("/")[-1].replace(".py","") in tests_to_ignore:
1171 1188 indices.append(i)
1172 1189 testnames = [v for i,v in enumerate(testnames) if i not in indices]
1173 1190
1174 1191 if testnames == [] or len(testnames) == 0:
1175 1192 print("List of tests is empty")
1176 1193 parser.print_help(sys.stderr)
1177 1194 sys.exit(1)
1195 + #print(testnames)
1196 + #sys.exit()
1178 1197 run(testnames, args.branch, DRY_RUN)
1179 1198 except:
1180 1199 traceback.print_exc()
1181 1200

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut