예제 #1
0
파일: asserts.py 프로젝트: zippies/Demeter
def assertContains(a, b, msg, funcname=None, func=str):
    if type(b) not in [list, tuple]:
        if func(b) not in func(a):
            savescreen(funcname)
            raise Exception(msg + ":'%s' not in '%s'" % (b, a))
    else:
        errorList = []
        for i in b:
            if func(i) not in func(a):
                errorList.append("'%s' not in '%s'" % (i, a))
        if errorList:
            savescreen(funcname)
            raise Exception(msg + "|".join(errorList))
예제 #2
0
파일: asserts.py 프로젝트: zippies/Demeter
def assertNotEquals(a, b, msg, funcname=None, func=str):
    if func(a) == func(b):
        if funcname:
            savescreen(funcname)
        raise Exception(msg + ":%s == %s" % (a, b))
예제 #3
0
파일: asserts.py 프로젝트: zippies/Demeter
def assertEmpty(a, msg, funcname=None):
    if a:
        if funcname:
            savescreen(funcname)
        raise Exception(msg)
예제 #4
0
    from commons.base.driver import driver
    from config import Config, report_template
    from commons.base.utils import parse_report_file, savescreen
    from jinja2 import Template
    import time
    import pytest
    import os

    current_time = time.strftime("%Y_%m_%d_%H%M%S")
    with open("cur_time", "w") as f:
        f.write(current_time)

    sys.argv.extend(["--junitxml=%s.xml" % current_time])
    pytest.main(args=sys.argv[1:])
    savescreen("end")
    if Config.DEBUG:
        report_path = os.getcwd() + "/%s.xml" % current_time

        result_dict = parse_report_file(report_path, current_time)

        html_report = Template(report_template).render(test_result=result_dict)

        report_file = "file://" + os.getcwd(
        ) + "/reports/%s.html" % current_time

        with open("reports/%s.html" % current_time, "w") as f:
            f.write(html_report)

        os.system("rm -rf *.xml cur_time")