示例#1
0
def main():
    CreateDir.create_dir(REPORT_DIR)
    html_name = CreateDir.generate_filename('html')
    # args = ['-v','--reruns', '1', 'cases','--html=report/' + html_name,'--self-contained-html']
    args = [
        '-v', 'cases', '--html=report/' + html_name, '--self-contained-html'
    ]
    pytest.main(args)
    sendemail('%s/%s' % (REPORT_DIR, html_name))
示例#2
0
def main():
    CreateDir.create_dir(REPORT_DIR)
    html_name = CreateDir.generate_filename('html')

    # addopts = -v --reruns 1 - -html = report / report.html --self-contained-html
    # args = ['-v','--reruns', '1', 'cases/apicases','--html=report/' + html_name,'--self-contained-html']
    # pytest.main(args)
    # sendemail('%s/%s'%(REPORT_DIR,html_name))
    print(html_name)
示例#3
0
        self._logger.addHandler(file_handler)

    @staticmethod
    def _set_formatter(file_handler):
        formatter = logging.Formatter('%(asctime)s-%(name)s-%(filename)s-[line:%(lineno)d]'
                                      '-%(levelname)s-[日志信息]: %(message)s',
                                      datefmt='%a, %d %b %Y %H:%M:%S')
        file_handler.setFormatter(formatter)

    @staticmethod
    def _close_handler(file_handler):
        file_handler.close()

    @property
    def logger(self):
        file_handler = self._init_handler()
        self._set_handler(file_handler)
        self._set_formatter(file_handler)
        self._close_handler(file_handler)
        return self._logger


log_name = CreateDir.generate_filename('log')
log_dir = CreateDir.create_dir(LOG_DIR)
log = Log(__name__, LOG_DIR + '/' + log_name)
logger = log.logger


if __name__ == '__main__':
        pass
示例#4
0
def main():
    CreateDir.create_dir(REPORT_DIR)
    html_name = CreateDir.generate_filename('html')
    args = ['--reruns', '1', '--html=' + './report/' + html_name]
    pytest.main(args)
示例#5
0
        file_handler.setLevel(level)
        self._logger.addHandler(file_handler)

    @staticmethod
    def _set_formatter(file_handler):
        formatter = logging.Formatter(
            '%(asctime)s-%(name)s-%(filename)s-[line:%(lineno)d]'
            '-%(levelname)s-[日志信息]: %(message)s',
            datefmt='%a, %d %b %Y %H:%M:%S')
        file_handler.setFormatter(formatter)

    @staticmethod
    def _close_handler(file_handler):
        file_handler.close()

    @property
    def logger(self):
        file_handler = self._init_handler()
        self._set_handler(file_handler)
        self._set_formatter(file_handler)
        self._close_handler(file_handler)
        return self._logger


log_name = CreateDir.generate_filename('log')
log = Log(__name__, LOG_DIR + '/' + log_name)
logger = log.logger

if __name__ == '__main__':
    pass