示例#1
0
文件: runner.py 项目: Auzzy/pyinq
def handle_assert(test):
    try:
        test()
    except AssertionError:
        trace = get_trace_start(exc_info()[2])[0]
        lineno = trace[1]
        call = trace[3]
        raise PyInqAssertError(lineno,call)
示例#2
0
def handle_assert(test):
    try:
        test()
    except AssertionError:
        trace = get_trace_start(exc_info()[2])[0]
        lineno = trace[1]
        call = trace[3]
        raise PyInqAssertError(lineno, call)
示例#3
0
文件: runner.py 项目: Auzzy/pyinq
def handle_error(expected):
    exc_type,exc_value,trace_obj = exc_info()[:3]
    trace = get_trace_start(trace_obj)
    if expected and isinstance(exc_value,expected):
        lineno = trace[0][1]
        result = ExpectedErrorResult(True,expected,lineno)
        halt = False
    else:
        tb_str = create_tb_str(exc_type,exc_value,trace)
        result = UnexpectedError(tb_str)
        halt = True
    return result,halt
示例#4
0
def handle_error(expected):
    exc_type, exc_value, trace_obj = exc_info()[:3]
    trace = get_trace_start(trace_obj)
    if expected and isinstance(exc_value, expected):
        lineno = trace[0][1]
        result = ExpectedErrorResult(True, expected, lineno)
        halt = False
    else:
        tb_str = create_tb_str(exc_type, exc_value, trace)
        result = UnexpectedError(tb_str)
        halt = True
    return result, halt