def mk_arrangement__executable_file(symbols: SymbolTable) -> Arrangement: return arrangement_w_tcds( symbols=symbols, tcds_contents=executable_file_relativity. populator_for_relativity_option_root( fs.DirContents( [fs.executable_file(executable_program_file_name)])))
def runTest(self): act_phase_instructions = [instr(['system-under-test'])] with home_directory_structure( contents=contents_in(RelHomeOptionType.REL_HOME_ACT, fs.DirContents([ fs.executable_file('system-under-test')]))) as hds: environment = InstructionEnvironmentForPreSdsStep(hds, {}) executor = self.actor.parse(act_phase_instructions) actual = executor.validate_pre_sds(environment) self.assertIs(svh.SuccessOrValidationErrorOrHardErrorEnum.SUCCESS, actual.status, 'Validation result')
def runTest(self): act_phase_instructions = [instr(['system-under-test'])] with home_directory_structure(contents=contents_in( RelHdsOptionType.REL_HDS_ACT, fs.DirContents([fs.executable_file('system-under-test') ]))) as hds: environment = InstructionEnvironmentPreSdsBuilder.of_empty_env( hds=hds).build executor = self.actor.parse(act_phase_instructions) actual = executor.validate_pre_sds(environment) self.assertIs(svh.SuccessOrValidationErrorOrHardErrorEnum.SUCCESS, actual.status, 'Validation result')
def runTest(self): # ARRANGE # conf = self.configuration arguments_str = _exe_file_syntax_str(conf, 'file.exe', 'remaining args') source = ParseSource(arguments_str) # ACT # exe_file = parse_executable_file_path.parser().parse(source) # ASSERT # source_assertion = has_remaining_part_of_first_line('remaining args') source_assertion.apply_with_message(self, source, 'source after parse') self._check_existence_pre_sds(exe_file, empty_symbol_table()) with self._tcds_and_test_as_curr_dir( executable_file('file.exe')) as environment: self._check_file_path('file.exe', exe_file, environment) self._assert_passes_validation(exe_file, environment)
def cases__w_argument_list__excluding_program_reference() -> List[PgmAndArgsCase]: """Cases of pgm-and-arg:s that have a list of arguments.""" executable_file = fs.executable_file('executable-file', '') exe_file_relativity = rel_opt.conf_rel_hds(RelHdsOptionType.REL_HDS_CASE) executable_file_ddv = path_ddvs.of_rel_option(exe_file_relativity.relativity, path_ddvs.constant_path_part(executable_file.name) ) system_program = 'the-system-program' return [ PgmAndArgsCase.w_tcds( 'executable file', pgm_and_args=pgm_abs_stx.ProgramOfExecutableFileCommandLineAbsStx( exe_file_relativity.named_file_conf(executable_file.name).abstract_syntax ), expected_command_driver=lambda env: ( asrt_command.matches_executable_file_command_driver( asrt.equals(executable_file_ddv.value_of_any_dependency__d(env.tcds).primitive), )), tcds=exe_file_relativity.populator_for_relativity_option_root__hds( DirContents([executable_file]) ) ), PgmAndArgsCase.wo_tcds( '-python', pgm_and_args=pgm_abs_stx.ProgramOfPythonInterpreterAbsStx(()), expected_command_driver=prim_asrt__constant( asrt_command.matches_executable_file_command_driver( asrt_path.path_as_str(asrt.equals(sys.executable)), )), ), PgmAndArgsCase.wo_tcds( 'system program', pgm_and_args=pgm_abs_stx.ProgramOfSystemCommandLineAbsStx( StringLiteralAbsStx(system_program) ), expected_command_driver=prim_asrt__constant( asrt_command.matches_system_program_command_driver( asrt.equals(system_program) )) ), ]
def exe_file_in_interpreter_default_relativity_dir(file_name: str) -> hds_populators.HdsPopulator: return relativity_configurations.INTERPRETER_FILE.populator_for_relativity_option_root__hds( fs.DirContents([fs.executable_file(file_name)]) )