def test_group_error(self): try: validate_method_output(method_error_group, 'ERROR error group\n' ' PASSED passed step\n' ' ERROR error step') except Exception as inst: eq_(inst, error_exception)
def test_group_fail(self): try: validate_method_output(method_fail_group, 'FAILED failed group\n' ' PASSED passed step\n' ' FAILED failed step') except Exception as inst: eq_(inst, failure_exception)
def test_group_fail(self): try: validate_method_output( method_fail_group, 'FAILED failed group\n' ' PASSED passed step\n' ' FAILED failed step') except Exception as inst: eq_(inst, failure_exception)
def test_group_error(self): try: validate_method_output( method_error_group, 'ERROR error group\n' ' PASSED passed step\n' ' ERROR error step') except Exception as inst: eq_(inst, error_exception)
def test_failed(self): try: work_dir = os.getcwd() sep_symbol = '/' if '\\' in work_dir: sep_symbol = '\\' validate_method_output(self.TestObjectFailed('test_failed').test_failed, 'FAILED failed step: My Exception\n' ' File "{0}/tests/full_run/test_failed.py", line 15, in test_failed\n' ' self.failed_step()\n' ' File "{0}/grail/steps.py", line 120, in _execute\n' ' output = step_info.run_function()\n' ' File "{0}/grail/step_info.py", line 59, in run_function\n' ' result = self.function(*self.args, **self.kwargs)\n' ' File "{0}/tests/full_run/test_failed.py", line 19, in failed_step\n' ' raise self.to_raise'.replace('/', sep_symbol).format(os.getcwd())) except Exception as inst: eq_(inst, self.TestObjectFailed.to_raise)
def test_error(self): try: work_dir = os.getcwd() sep_symbol = '/' if '\\' in work_dir: sep_symbol = '\\' validate_method_output(self.TestObjectFailed('test_error').test_error, 'ERROR error step: My Exception\n' ' File "{0}/tests/full_run/test_error.py", line 15, in test_error\n' ' self.error_step()\n' ' File "{0}/grail/steps.py", line 118, in _execute\n' ' output = step_info.run_function()\n' ' File "{0}/grail/step_info.py", line 58, in run_function\n' ' return self.function(*self.args, **self.kwargs)\n' ' File "{0}/tests/full_run/test_error.py", line 19, in error_step\n' ' raise self.to_raise'.replace('/', sep_symbol).format(os.getcwd())) except Exception as inst: eq_(inst, self.TestObjectFailed.to_raise)
def test_error(self): try: work_dir = os.getcwd() sep_symbol = '/' if '\\' in work_dir: sep_symbol = '\\' validate_method_output( self.TestObjectFailed('test_error').test_error, 'ERROR error step: My Exception\n' ' File "{0}/tests/full_run/test_error.py", line 15, in test_error\n' ' self.error_step()\n' ' File "{0}/grail/steps.py", line 120, in _execute\n' ' output = step_info.run_function()\n' ' File "{0}/grail/step_info.py", line 59, in run_function\n' ' result = self.function(*self.args, **self.kwargs)\n' ' File "{0}/tests/full_run/test_error.py", line 19, in error_step\n' ' raise self.to_raise'.replace('/', sep_symbol).format( os.getcwd())) except Exception as inst: eq_(inst, self.TestObjectFailed.to_raise)
def test_enabled_output(self): validate_method_output(self.step_with_output, 'PASSED step with output -> Printed data')
def test_step_with_kwargs(self): validate_method_output(step_with_kwargs, "step with kwargs (a=b)", kwargs={"a": "b"})
def test_print_kwargs_params(self): validate_method_output(step_with_params, "step with params (some_string=42)", kwargs={"some_string": "42"})
def test_step_group(self): validate_method_output(step_group, "step group\n" " simple step\n" " pending step")
def test_step_disabling_with_params(self): validate_method_output(self.disabled_step_params, u'Some data after params')
def test_ingore_output(self): validate_method_output(self.method_with_two_groups, 'FAILED pass fail ignore group\n' ' PASSED step1\n' ' FAILED fail step: Explicit error\n' ' IGNORED ignored step\n' 'IGNORED pass fail ignore group')
def test_returning_unicode(self): validate_method_output(self.step_with_returning_unicode, u'PASSED step with returning unicode -> Привет!!!')
def test_step_disabling(self): validate_method_output(self.disabled_step, u'Some data')
def test_disabled_input_logging(self): validate_method_output(self.step_with_not_logged_input, 'PASSED step with not logged input', ['data'])
def test_enabled_input_logging(self): validate_method_output(self.step_with_logged_input, 'PASSED step with logged input (data)', ['data'])
def test_disabled_output(self): validate_method_output(self.step_with_disabled_output, 'PASSED step with disabled output')
def test_format_params(self): validate_method_output(step_with_format_params, 'Some info \'None\' kw42', args=(None, ), kwargs={'kw_str': 'kw42'})
def test_passed_flow(self): validate_method_output(self.some_step_group, 'PASSED some step group\n' ' PASSED step1\n' ' PASSED step2')
def test_step_with_args(self): validate_method_output(step_with_args, 'step with args', args=(None, None))
def test_explicit_disable(self): validate_method_output(self.explicit_step_call_skip, 'PASSED explicit step call skip')
def test_print_args_params(self): validate_method_output(step_with_params, "step with params (42)", args=("42",))
def test_localization_exception(self): validate_method_output(self.verify_step, u'PASSED verify step (\ufffd\ufffd\ufffd, \ufffd\ufffd)\n' u' \ufffd\ufffd\ufffd\ufffd\ufffd', args=(korean_string, russian_string))
def test_format_params(self): validate_method_output( step_with_format_params, "Some info 'None' kw42", args=(None,), kwargs={"kw_str": "kw42"} )
def test_dict_params(self): validate_method_output(self.eq_dict, u'PASSED eq dict ({}, {})', args=({}, {}))
def test_step_with_args(self): validate_method_output(step_with_args, "step with args", args=(None, None))
def test_simple_output(self): validate_method_output(simple_step, 'simple step')
def test_step_time(self): validate_method_output(self.some_step, '[0.50s] PASSED some step')
def test_description(self): validate_method_output(step_with_description, 'Some Description')
def test_three_statuses(self): validate_method_output(self.pass_fail_ignore_group, 'FAILED pass fail ignore group\n' ' PASSED step1\n' ' FAILED fail step: Explicit error\n' ' IGNORED ignored step')
def test_print_args_params(self): validate_method_output(step_with_params, 'step with params (42)', args=('42', ))
def test_pending_export(self): validate_method_output(self.TestObjectPendingExport('test_pending_export').test_pending_export, 'pending step')
def test_pending_status(self): validate_method_output(self.pass_pending_ignore_group, 'PENDING pass pending ignore group\n' ' PASSED step1\n' ' PENDING pending step\n' ' IGNORED ignored step')
def test_pending_output(self): validate_method_output(pending_step, 'pending step')
def test_passed(self): validate_method_output(self.TestObjectPassed('test_passed').test_passed, 'PASSED passed step')
def test_skip_none_params(self): validate_method_output(step_with_params, 'step with params')
def test_simple_output(self): validate_method_output(simple_step, "simple step")
def test_print_kwargs_params(self): validate_method_output(step_with_params, 'step with params (some_string=42)', kwargs={'some_string': '42'})
def test_pending_output(self): validate_method_output(pending_step, "pending step")
def test_step_group(self): validate_method_output( step_group, 'step group\n' ' simple step\n' ' pending step')
def test_description(self): validate_method_output(step_with_description, "Some Description")
def test_step_with_kwargs(self): validate_method_output(step_with_kwargs, 'step with kwargs (a=b)', kwargs={'a': 'b'})
def test_skip_none_params(self): validate_method_output(step_with_params, "step with params")