import  unittest 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								import  os 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								import  inspect 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								from  basic . program  import  Job 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								from  basic . componentHandling  import  ComponentManager 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								import  init_testcase 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								import  test_executer 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								import  test . constants 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								import  basic . constants  as  B 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								import  test . constants  as  T 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								HOME_PATH  =  test . constants . HOME_PATH 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								PYTHON_CMD  =  " python " 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								TEST_FUNCTIONS  =  [ " test_tdata " ,  " test_getCsvSpec_data " ,  " test_getCsvSpec_tree " ,  " test_getCsvSpec_key " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								                  " test_getCsvSpec_conf " ,   " test_extractPattern " ,  " test_parseCsv " ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								TEST_FUNCTIONS  =  [ " test_run " ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								class  MyTestCase ( unittest . TestCase ) : 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								    mymsg  =  " -------------------------------------------------------------- " 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								    def  test_parameter ( self ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        global  mymsg 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        actfunction  =  str ( inspect . currentframe ( ) . f_code . co_name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        cnttest  =  0 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        if  actfunction  not  in  TEST_FUNCTIONS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            return 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        job  =  Job ( " unit " ) 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								        args  =  {  " application "  :  " TEST "  ,  " environment "  :  " ENV01 " ,  " modus "  :  " unit " ,  " loglevel "  :  " debug " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								                 " tool "  :  " job_tool " ,  " function " :  " reset_TData,load_TData "  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        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 ) 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								        self . assertEqual ( job . hasFunction ( " reset_TData " ) ,  True ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        self . assertEqual ( job . hasFunction ( " load_TData " ) ,  True ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        self . assertEqual ( job . hasFunction ( " read_TData " ) ,  False ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        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_run ( self ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        global  mymsg 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        actfunction  =  str ( inspect . currentframe ( ) . f_code . co_name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        cnttest  =  0 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        if  actfunction  not  in  TEST_FUNCTIONS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            return 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        programs  =  [ " init_testcase " ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        testcase  =  " TC0001 " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        timexec  =  " 2022-06-28_21-23-34 " 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								        # os.system("python "+os.path.join(HOME_PATH, "check_environment.py")+" -a TEST -e ENV01") 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								        # os.system("python "+os.path.join(HOME_PATH, "init_testsuite.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") 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								        #args = { "application": "TEST", "environment": "ENV01", "modus": "unit", 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        #         "tool": "job_tool", "tsdir": os.path.join(HOME_PATH,"test","conf","lauf","V0.1","TC0001_2021-08-28_23-50-51")} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        #"loglevel": "debug", "tdtyp": "dir", 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								        #         "tdsrc": "TC0001", "tdname": "xxx", 
							 
						 
					
						
							
								
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
								        if  " init_testcase "  in  programs : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            program  =  " init_testcase " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            job  =  Job ( " unit " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            args  =  {  B . PAR_APP :  " TESTAPP " ,  B . PAR_ENV :  " ENV01 " ,  " modus " :  " unit " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								                     B . PAR_TCDIR :  os . path . join ( job . conf . confs [ B . SUBJECT_PATH ] [ B . ATTR_PATH_ARCHIV ] ,  testcase ,  timexec ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								                     " step " :  1  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            #         "usecase": "TST001", "tstime": "2022-03-17_17-28"} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            job . par . setParameterArgs ( args ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            job . setProgram ( program ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            init_testcase . startPyJob ( job ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            job . startJob ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            #test_executer.start(job) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								            job . stopJob ( 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								if  __name__  ==  ' __main__ ' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
								    unittest . main ( )