Ejemplo n.º 1
0
def _try_call(method):
    """Calls the given method, captures stdout and stderr,
    and returns the status (OK, SKIP, FAIL).
    """
    status = 'OK'
    try:
        start_profile()
        method()
    except unittest.SkipTest as e:
        status = 'SKIP'
        sys.stderr.write(str(e))
    except:
        status = 'FAIL'
        sys.stderr.write(traceback.format_exc())
    finally:
        stop_profile()

    return status
Ejemplo n.º 2
0
def try_call(method):
    """Calls the given method, captures stdout and stderr,
    and returns the status (OK, SKIP, FAIL).
    """
    status = "OK"
    try:
        start_profile()
        method()
    except Exception as e:
        msg = traceback.format_exc()
        if isinstance(e, unittest.SkipTest):
            status = "SKIP"
            sys.stderr.write(str(e))
        else:
            status = "FAIL"
            sys.stderr.write(msg)
    except:
        msg = traceback.format_exc()
        status = "FAIL"
        sys.stderr.write(msg)
    finally:
        stop_profile()

    return status