Exemple #1
0
 def setUpClass(cls):
     print("CLS : ", cls)
     cls.start_time = str(datetime.datetime.now().replace(microsecond=0))
     cls.test_case_id = cls.__name__
     print("LOG_DIR :", LOG_DIR)
     debug_logger.debug("------------------------- TEST CASE : " +
                        str(cls.test_case_id) + "-----------------------")
     debug_logger.debug(
         "-----------------------------------------------------------------------------------------"
         "------------------------------------")
     debug_logger.debug("LOG DIR : %s", str(LOG_DIR))
     case_log_dir = LOG_DIR + '/' + cls.test_case_id
     print("case_log_dir : ", case_log_dir)
     debug_logger.debug("case_log_dir : %s", str(case_log_dir))
     case_log = case_log_dir + '/' + cls.test_case_id + '.log'
     print("case_log : ", case_log)
     debug_logger.debug("case_log : %s", str(case_log))
     os.path.exists(case_log_dir) or os.makedirs(case_log_dir)
     Test2.test_case_result = 'PASSED'
     debug_logger.debug("Test2.test_case_result : %s",
                        str(Test2.test_case_result))
     Descriptions.teststage.append({cls.test_case_id: {}})
     TestcaseLog.log[cls.test_case_id] = case_log
     cls.handler = LOGGING.FileHandler(case_log, mode='w')
     formatter1 = LOGGING.Formatter(
         '[%(asctime)s] [%(levelname)s] - %(message)s')
     cls.handler.setFormatter(formatter1)
     cls.handler.setLevel(Params.log_level)
     logger.addHandler(cls.handler)
     logger.info("########## STARTING CASE: " + cls.test_case_id +
                 " ##########")
     debug_logger.debug("########## STARTING CASE: %s ##########",
                        str(cls.test_case_id))
Exemple #2
0
from winrunner.utils.models import User, Platform, TestSuite, TestBed, JobRequest, TestResult, ApTestSessionGroup
from winrunner.settings import Params, get_sonicauto_session, LOGGING, debug_logger

logger = LOGGING.getLogger(__name__)


class SonicAuto:
    default_args = {
        'g_cc': '',
        'g_scmlabel': '',
        'g_testbed': '',
        'g_avt_mountpoint': '',
        'g_build': '',
        'g_product': '',
        'g_user': '',
        'g_requesttime': '',
        'mount_point': '',
        'g_qbs': '',
        'g_resource': '',
        'bundle': '',
        'rgname': '',
        'log_level': '',
        'log_dir': ''
    }

    def __init__(self):
        debug_logger.info("*** init ***")
        self.session = get_sonicauto_session()

    def get_session_group_name(self, scmlabel, productid):
        try: