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 = six.get_unbound_function(getattr(step_cls, attr_name))
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))
评论列表
文章目录