def test_check_non_zero_exit_code(self): self._check_single_line_arguments_with_source_variants( args.sequence([pgm_args.interpret_py_source_file('exit-with-value-on-command-line.py'), 2]).as_str, tcds_test.Arrangement( hds_contents_before=hds_case_dir_contents(DirContents([ File('exit-with-value-on-command-line.py', py_pgm_that_exits_with_1st_value_on_command_line('on stderr'))]))), tcds_test.Expectation( expected_action_result=result_assertions.equals(2, 'on stderr'), ) )
def test_invalid_executable(self): argument = '/not/an/executable/program {} {} {}'.format(args.option(syntax_elements.EXISTING_FILE_OPTION_NAME), 'exit-with-value-on-command-line.py', 0) self._check_single_line_arguments_with_source_variants( argument, tcds_test.Arrangement( hds_contents_before=hds_case_dir_contents(DirContents([ File('exit-with-value-on-command-line.py', py_pgm_that_exits_with_1st_value_on_command_line(''))]))), tcds_test.Expectation( acton_raises_hard_error=True, ))
def test_check_zero_exit_code__rel_tmp(self): self._check_single_line_arguments_with_source_variants( args.sequence([ pgm_args.interpret_py_source_file( path_arguments.RelOptPathArgument('exit-with-value-on-command-line.py', RelOptionType.REL_TMP)), 0, ]).as_str, tcds_test.Arrangement( sds_contents_before=contents_in(RelSdsOptionType.REL_TMP, DirContents([ File('exit-with-value-on-command-line.py', py_pgm_that_exits_with_1st_value_on_command_line(''))]))), tcds_test.Expectation( expected_action_result=result_assertions.equals(0, None)), )
def test_check_non_zero_exit_code(self): self._check_single_line_arguments_with_source_variants( pgm_args.interpret_py_source_line('exit(1)').as_str, tcds_test.Arrangement(), tcds_test.Expectation(expected_action_result=result_assertions.equals(1, '')))
def test_check_non_zero_exit_code_with_output_to_stderr(self): python_program = 'import sys; sys.stderr.write("on stderr"); exit(2)' self._check_single_line_arguments_with_source_variants( self._python_interpreter_for_source_on_command_line(python_program), tcds_test.Arrangement(), tcds_test.Expectation(expected_action_result=result_assertions.equals(2, 'on stderr')))
def test_check_non_zero_exit_code(self): self._check_single_line_arguments_with_source_variants( self._python_interpreter_for_source_on_command_line('exit(1)'), tcds_test.Arrangement(), tcds_test.Expectation(expected_action_result=result_assertions.equals(1, '')))
def test_invalid_executable(self): self._check_single_line_arguments_with_source_variants( '/not/an/executable/program', tcds_test.Arrangement(), tcds_test.Expectation(acton_raises_hard_error=True))