# program to copy dummy-file as testcase-results # ------------------------------------------------------------------------------------------------------------- """ """ import os import shutil import basic.program import utils.path_tool import utils.file_tool import basic.constants as B import utils.tdata_tool import basic.componentHandling import utils.path_const as P import basic.message as message PROGRAM_NAME = "copy_appdummy" PROGRAM_DUMMY = "collect_testcase" def startPyJob(job): cm = basic.componentHandling.ComponentManager.getInstance(job) cm.initComponents() comps = cm.getComponents(PROGRAM_DUMMY) job.m.setMsg("# Components initialized with these relevant components " + str(comps)) cm = basic.componentHandling.ComponentManager.getInstance(job, "init") print("cm " + str(cm)) cm.initComponents() comps = cm.getComponents(PROGRAM_DUMMY) for c in comps: comp = cm.getComponent(c) for cond in ["pre", "post"]: tdatapath = utils.path_tool.composePattern(job, "{td"+cond+"exec}", comp) envapppath = utils.path_tool.composePattern(job, "{tc"+cond+"cond}", comp) if os.path.exists(tdatapath): files = utils.file_tool.getFiles(job.m, job, tdatapath, ".+\.csv", None) for f in files: # shutil.copy() print("cp " + os.path.join(tdatapath, f) + " " + os.path.join(envapppath, f)) utils.file_tool.mkPaths(job, os.path.join(envapppath, f), job.m) shutil.copy(os.path.join(tdatapath, f), os.path.join(envapppath, f)) print(tdatapath) # Press the green button in the gutter to run the script. if __name__ == '__main__': print(PROGRAM_NAME) x = basic.program.Job(PROGRAM_NAME) x.startJob() x.m.logDebug(str(vars(x.par)) + "\n" + str(vars(x.conf))) if x.m.isRc("fatal"): x.stopJob() exit(x.m.rc * (-1) + 3) startPyJob(x) x.stopJob() # See PyCharm help at https://www.jetbrains.com/help/pycharm/