import unittest import os from basic.program import Job from basic.componentHandling import ComponentManager import init_testcase import test.constants HOME_PATH = test.constants.HOME_PATH PYTHON_CMD = "python" class MyTestCase(unittest.TestCase): def runTest(self): self.test_parameter() self.test_components() self.test_run() def test_parameter(self): job = Job("unit") args = { "application" : "TEST" , "environment" : "ENV01", "modus" : "unit", "loglevel" : "debug", "tool" : "job_tool"} job.par.setParameterArgs(args) self.assertEqual(job.hascomponente("TestA"), True) self.assertEqual(job.hasTool("TestA"), False) self.assertEqual(job.hasTool("job_tool"), True) self.assertEqual(job.getDebugLevel("file_tool"), 23) self.assertEqual(job.getDebugLevel("job_tool"), 23) args = { "application" : "TEST" , "environment" : "ENV01", "modus" : "unit", "loglevel" : "debug", "tool" : "job_tool", "tsdir": os.path.join(HOME_PATH, "test", "lauf", "V0.1", "startjob", "2021-08-21_18-ß2-01")} job.par.setParameterArgs(args) def test_components(self): print("# # # # tetsComponents # # # # #") job = Job.resetInstance("unit") args = { "application" : "TEST" , "environment" : "ENV01", "modus" : "unit", "loglevel" : "debug", "tool" : "job_tool"} job.par.setParameterArgs(args) cm = ComponentManager() cm.createComponents("testb", 0, "") cm.createComponents("testa", 1, "") def test_run(self): # os.system("python "+os.path.join(HOME_PATH, "check_environment.py")+" -a TEST -e ENV01") # os.system("python "+os.path.join(HOME_PATH, "init_testset.py")+" -a TEST -e ENV01 " # "-ts "+os.path.join(HOME_PATH, "test","lauf","V0.1","implement_2021-08-28_23-50-51")+" -dt csv -ds implement -dn firstunit") #os.system(PYTHON_CMD+" "+os.path.join(HOME_PATH,"init_testcase.py")+" -a TEST -e ENV01 " # "-tc "+os.path.join(HOME_PATH,"test","lauf","V0.1","TC0001","2021-08-28_23-50-51")+" -dt csv -ds implement -dn TC0001") job = Job("unit") args = { "application": "TEST", "environment": "ENV01", "modus": "unit", "loglevel": "debug", "tdtyp": "dir", "tdsrc": "TC0001", "tdname": "xxx", "tool": "job_tool", "tcdir": os.path.join(HOME_PATH,"test","lauf","V0.1","TC0001","2021-08-28_23-50-51")} job.par.setParameterArgs(args) job.setProgram("init_testcase") init_testcase.start(job) job.stopJob(1) if __name__ == '__main__': unittest.main()