コード例 #1
0
ファイル: logger.py プロジェクト: hayderimran7/stepler
def _reject_self_from_args(func, args):
    func_name = getattr(func, '__name__', str(func))
    args = list(args)
    if args:
        arg = args[0]
        im_func = getattr(getattr(arg, func_name, None), 'im_func', None)
        if utils.get_unwrapped_func(im_func) is utils.get_unwrapped_func(func):
            args.remove(arg)
    return args
コード例 #2
0
def pytest_configure(config):
    """Hook to check steps consistency."""
    if config.option.disable_steps_checker:
        config.warn('P1', 'Step consistency checker is disabled!')
        return

    errors = []
    for step_cls in _get_step_classes():
        for attr_name in dir(step_cls):

            if attr_name not in STEPS:
                continue

            step_func = getattr(step_cls, attr_name).im_func
            step_func = utils.get_unwrapped_func(step_func)

            error = _verify_docstring_present(step_func)
            if error:
                errors.append(error)

            if step_func.__name__.startswith('get_'):
                errors.extend(_validate_get_step(step_func))

            elif step_func.__name__.startswith('check_'):
                errors.extend(_validate_check_step(step_func))

            else:  # change step
                errors.extend(_validate_change_step(step_func))
    if errors:
        pytest.exit('Some steps are not consistent!\n' + '\n'.join(errors))
コード例 #3
0
def pytest_configure(config):
    """Hook to check steps consistency."""
    if config.option.disable_steps_checker:
        config.warn('P1', 'Step consistency checker is disabled!')
        return

    errors = []
    for step_cls in _get_step_classes():
        for attr_name in dir(step_cls):

            if attr_name not in STEPS:
                continue

            step_func = getattr(step_cls, attr_name).im_func
            step_func = utils.get_unwrapped_func(step_func)

            validator = StepValidator(step_func)

            errors.extend(validator.validate())
    if errors:
        pytest.exit('Some steps are not consistent!\n' + '\n'.join(errors))
コード例 #4
0
 def patched_getargspec(func):
     if type(func) is not partial:
         func = get_unwrapped_func(func)
     return orig_getargspec(func)