#NEWLINE# def _do_unittest( self , ctxt , lp_handler , build_id , git_info , name , base_image_id , source_format , image_format , assembly_id , test_cmd ) : #NEWLINE# #INDENT# if ( test_cmd is None ) : #NEWLINE# #INDENT# LOG . debug ( 'Unit test command is None; skipping unittests.' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# lp = validate_lp ( ctxt , base_image_id , assembly_id ) #NEWLINE# if ( not lp ) : #NEWLINE# #INDENT# update_assembly_status ( ctxt , assembly_id , ASSEMBLY_STATES . ERROR ) #NEWLINE# return ( - 1 ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# assem = objects . registry . Assembly . get_by_id ( ctxt , assembly_id ) #NEWLINE# if ( assem . status == ASSEMBLY_STATES . DELETING ) : #NEWLINE# #INDENT# LOG . debug ( ( 'Assembly %s is being deleted..skipping next stages' % assembly_id ) ) #NEWLINE# return ( - 1 ) #NEWLINE# #UNINDENT# #UNINDENT# except exception . ObjectNotFound : #NEWLINE# #INDENT# LOG . debug ( ( 'Assembly %s was deleted, skipping unittesting.' % assembly_id ) ) #NEWLINE# return ( - 1 ) #NEWLINE# #UNINDENT# update_assembly_status ( ctxt , assembly_id , ASSEMBLY_STATES . UNIT_TESTING ) #NEWLINE# result = lp_handler . unittest_app ( git_info , lp . external_ref , lp . docker_image_name , test_cmd ) #NEWLINE# if ( lp == 0 ) : #NEWLINE# #INDENT# status = ASSEMBLY_STATES . UNIT_TESTING_PASSED #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( result > 0 ) : #NEWLINE# #INDENT# status = ASSEMBLY_STATES . UNIT_TESTING_FAILED #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# status = ASSEMBLY_STATES . ERROR #NEWLINE# #UNINDENT# #UNINDENT# update_assembly_status ( ctxt , assembly_id , status ) #NEWLINE# return result