Example #1
0
def check_actor_execution(put: unittest.TestCase,
                          arrangement: Arrangement,
                          expectation: Expectation):
    instruction = sut.Parser().parse(ARBITRARY_FS_LOCATION_INFO, arrangement.source)
    configuration_builder = _configuration_builder_with_exception_throwing_act_phase_setup()
    assert isinstance(instruction, ConfigurationPhaseInstruction)
    instruction.main(configuration_builder)
    act_phase_instructions = [instr(arrangement.act_phase_source_lines)]
    integration_check.check_execution(
        put,
        configuration_builder.actor.value,
        act_phase_instructions,
        integration_check.arrangement_w_tcds(
            hds_contents=arrangement.hds_contents,
            process_execution=ProcessExecutionArrangement(
                os_services=arrangement.os_services,
            )),
        integration_check.Expectation(
            symbol_usages=expectation.symbol_usages,
            post_sds=PostSdsExpectation.constant(
                sub_process_result_from_execute=expectation.sub_process_result_from_execute
            ),
            after_execution=expectation.after_execution
        )
    )
    expectation.source_after_parse.apply_with_message(put, arrangement.source, 'source after parse')
Example #2
0
def environment_exe_case(
    environment: Dict[str, str],
    program_symbol_name: str,
) -> NExArr[PrimAndExeExpectation[MatcherWTrace, MatchingResult], Arrangement]:
    py_file = File(
        'environment-vars-check.py',
        py_programs.
        pgm_that_exists_with_zero_exit_code_iff_environment_vars_not_included(
            environment))

    py_file_rel_opt_conf = rel_opt.conf_rel_any(RelOptionType.REL_TMP)
    py_file_conf = py_file_rel_opt_conf.named_file_conf(py_file.name)

    program_symbol = ProgramSymbolContext.of_sdv(
        program_symbol_name,
        program_sdvs.interpret_py_source_file_that_must_exist(
            py_file_conf.path_sdv))

    return NExArr(
        'Environment: {}'.format(repr(environment)),
        PrimAndExeExpectation.of_exe(
            main_result=asrt_run.is_result_for_py_interpreter(
                py_run_programs.EXIT_CODE_FOR_SUCCESS)),
        arrangement_w_tcds(
            tcds_contents=py_file_rel_opt_conf.
            populator_for_relativity_option_root(DirContents([py_file])),
            symbols=program_symbol.symbol_table,
            process_execution=ProcessExecutionArrangement(
                process_execution_settings=ProcessExecutionSettings.
                with_environ(environment))))
Example #3
0
 def runTest(self):
     # ARRANGE #
     expected_file_name = 'quoted file name.src'
     act_phase_instructions = [instr([str(surrounded_by_hard_quotes(expected_file_name))]),
                               instr([''])]
     executor_that_records_arguments = CommandExecutorThatRecordsArguments()
     arrangement = integration_check.arrangement_w_tcds(
         hds_contents=contents_in(RelHdsOptionType.REL_HDS_ACT, DirContents([
             File.empty(expected_file_name)])),
         process_execution=ProcessExecutionArrangement(
             os_services=os_services_access.new_for_cmd_exe(executor_that_records_arguments)
         )
     )
     expectation = integration_check.Expectation()
     # ACT #
     integration_check.check_execution(self,
                                       ACTOR_THAT_RUNS_PYTHON_PROGRAM_FILE,
                                       act_phase_instructions,
                                       arrangement, expectation)
     # ASSERT #
     expected_command = asrt_command.matches_command(
         driver=asrt_command.matches_executable_file_command_driver(asrt.anything_goes()),
         arguments=asrt.matches_sequence([
             asrt_path.str_as_path(asrt_path.name_equals(expected_file_name))
         ])
     )
     expected_command.apply_with_message(
         self,
         executor_that_records_arguments.command,
         'command',
     )
def _check(put: unittest.TestCase,
           integer_matcher: IntegerMatcherAbsStx,
           integer_matcher_symbols: List[SymbolContext]):
    # ARRANGE #
    program_symbol = ProgramSymbolContext.of_arbitrary_value('PROGRAM_SYMBOL')
    all_symbols = [program_symbol] + integer_matcher_symbols

    command_execution_counter = recording.Counter(initial_value=0)
    # ACT & ASSERT #
    CHECKER.check__abs_stx(
        put,
        InstructionArguments(
            program_symbol.abstract_syntax,
            integer_matcher,
        ),
        ArrangementPostAct2(
            symbols=SymbolContext.symbol_table_of_contexts(all_symbols),
            process_execution=ProcessExecutionArrangement(
                os_services=os_services_w_cmd_exe_counting__w_wrapped(
                    command_execution_counter,
                    CommandExecutorThatJustReturnsConstant(1)
                ),
            )
        ),
        Expectation2(
            ParseExpectation(
                symbol_usages=SymbolContext.usages_assertion_of_contexts(all_symbols)
            )
        ),
    )
    put.assertEqual(1,
                    command_execution_counter.value,
                    'number of times the program has been executed')
Example #5
0
def arrangement_wo_tcds(
    symbols: Optional[SymbolTable] = None,
    process_execution:
    ProcessExecutionArrangement = ProcessExecutionArrangement(),
) -> Arrangement:
    """
    :return: An Arrangement with will NOT create a TCDS
    """
    return Arrangement(symbols, None, process_execution)
Example #6
0
class _TestWhenMultipleInvocationsForModelWExtDepsThenPathForExpectedMustBeCreatedOnlyOnce(unittest.TestCase):
    proc_exe_arr = ProcessExecutionArrangement()

    def runTest(self):
        expected_contents = 'expected-contents'
        resolving_env = PathResolvingEnvironmentPreOrPostSds(fake_tcds())

        sdv = self._sdv_expecting_equals(expected_contents)
        adv = sdv.resolve(resolving_env.symbols).value_of_any_dependency(resolving_env.tcds)

        for actual_contents in [expected_contents, expected_contents + '-unexpected']:
            expected_result = actual_contents == expected_contents
            expected_matching_result = asrt_matching_result.matches_value(expected_result)
            with self.subTest(expected_result=expected_result):
                model_w_ext_deps = model_constructor.of_str(
                    self,
                    actual_contents,
                    may_depend_on_external_resources=True,
                )
                with tmp_dir() as dir_space_dir__matcher:
                    matcher = adv.primitive(self._app_env(dir_space_dir__matcher, 'matcher-path'))
                    with tmp_dir() as dir_space_dir__model:
                        model = model_w_ext_deps(FullResolvingEnvironment(
                            resolving_env.symbols,
                            resolving_env.tcds,
                            self._app_env(dir_space_dir__model, 'model-path')
                        ))
                        # ACT #
                        matching_result_1st = matcher.matches_w_trace(model)
                        matching_result_2nd = matcher.matches_w_trace(model)
                        # ASSERT #
                        expected_matching_result.apply_with_message(self, matching_result_1st, '1st')
                        expected_matching_result.apply_with_message(self, matching_result_2nd, '2nd')

    def _app_env(self,
                 dir_space_dir: pathlib.Path,
                 path_name_prefix: str,
                 ) -> ApplicationEnvironment:
        dir_file_space__matcher = TmpFileSpaceThatAllowsSinglePathGeneration(
            self,
            dir_space_dir,
            path_name_prefix,
        )
        return ApplicationEnvironment(
            self.proc_exe_arr.os_services,
            self.proc_exe_arr.process_execution_settings,
            dir_file_space__matcher,
            2 ** 10,
        )

    @staticmethod
    def _sdv_expecting_equals(expected_contents: str) -> StringMatcherSdv:
        source = args2.Equals.eq_string(expected_contents).as_remaining_source
        return integration_check.CHECKER__PARSE_SIMPLE.parser.parse(source)
Example #7
0
 def __init__(
     self,
     tcds: Optional[TcdsArrangementPreAct] = None,
     symbols: Optional[SymbolTable] = None,
     process_execution:
     ProcessExecutionArrangement = ProcessExecutionArrangement(
         process_execution_settings=proc_exe_env_for_test()),
     atc_exe_input: AtcExeInputArr = AtcExeInputArr(),
     mem_buff_size: int = 2**10,
 ):
     self.symbol_table = symbol_table_from_none_or_value(symbols)
     self.tcds = tcds
     self.process_execution = process_execution
     self.atc_exe_input = atc_exe_input
     self.mem_buff_size = mem_buff_size
Example #8
0
 def __init__(
     self,
     symbols: Optional[SymbolTable] = None,
     tcds: Optional[TcdsArrangement] = None,
     process_execution:
     ProcessExecutionArrangement = ProcessExecutionArrangement(),
     mem_buff_size: int = 2**10,
 ):
     """
     :param tcds: Not None iff TCDS is used (and must thus be created)
     """
     self.symbols = symbol_table_from_none_or_value(symbols)
     self.tcds = tcds
     self.process_execution = process_execution
     self.mem_buff_size = mem_buff_size
Example #9
0
    def runTest(self):
        # ARRANGE #
        program_symbol = ProgramSymbolContext.of_arbitrary_value(
            'PROGRAM_SYMBOL')
        executor_that_do_not_run_any_program = CommandExecutorThatJustReturnsConstant(
            0)

        for may_depend_on_external_resources in [False, True]:
            for with_ignored_exit_code in [False, True]:
                with self.subTest(
                        with_ignored_exit_code=with_ignored_exit_code,
                        may_depend_on_external_resources=
                        may_depend_on_external_resources):
                    # ACT && ASSERT #
                    pass
                integration_check.CHECKER__PARSE_SIMPLE.check(
                    self,
                    args.syntax_for_run(
                        program_args.symbol_ref_command_elements(
                            program_symbol.name),
                        ignore_exit_code=with_ignored_exit_code,
                    ).as_remaining_source,
                    model_constructor.empty(self,
                                            may_depend_on_external_resources=
                                            may_depend_on_external_resources),
                    arrangement_w_tcds(
                        symbols=program_symbol.symbol_table,
                        process_execution=ProcessExecutionArrangement(
                            os_services=os_services_access.new_for_cmd_exe(
                                executor_that_do_not_run_any_program)),
                    ),
                    Expectation(
                        ParseExpectation(symbol_references=program_symbol.
                                         references_assertion, ),
                        ExecutionExpectation(
                            main_result=asrt_string_source.
                            pre_post_freeze__matches_lines(
                                asrt.anything_goes(),
                                may_depend_on_external_resources=asrt.equals(
                                    True),
                                frozen_may_depend_on_external_resources=asrt.
                                anything_goes(),
                            )),
                        prim_asrt__constant(
                            asrt_string_transformer.is_identity_transformer(
                                False)),
                    ),
                )
Example #10
0
 def runTest(self):
     with self.config.program_that_sleeps_at_least(5) as setup:
         self._check(
             setup.act_phase_instructions,
             arrangement_w_tcds(
                 symbol_table=setup.symbols,
                 hds_contents=_hds_pop_of(setup),
                 process_execution=ProcessExecutionArrangement(
                     process_execution_settings=proc_exe_env_for_test(
                         timeout_in_seconds=1,
                         environ=setup.environ,
                     ))),
             Expectation(
                 symbol_usages=setup.symbol_usages,
                 execute=eh_assertions.is_hard_error,
             ),
         )
Example #11
0
 def runTest(self):
     # ARRANGE #
     atc_file_name = 'existing-file.py'
     arg_1 = 'un-quoted'
     arg_2 = 'single quoted'
     arg_3 = 'double quoted'
     act_line_1 = '{} {} {} {}'.format(
         atc_file_name,
         arg_1,
         surrounded_by_hard_quotes(arg_2),
         surrounded_by_soft_quotes(arg_3),
     )
     atc_line_2 = ''
     act_phase_instructions = [instr([act_line_1]),
                               instr([atc_line_2])]
     executor_that_records_arguments = CommandExecutorThatRecordsArguments()
     arrangement = integration_check.arrangement_w_tcds(
         hds_contents=contents_in(RelHdsOptionType.REL_HDS_ACT, DirContents([
             File.empty(atc_file_name)])),
         process_execution=ProcessExecutionArrangement(
             os_services=os_services_access.new_for_cmd_exe(executor_that_records_arguments)
         )
     )
     expected_command = asrt_command.matches_command(
         driver=asrt_command.matches_executable_file_command_driver(asrt.anything_goes()),
         arguments=asrt.matches_sequence([
             asrt_path.str_as_path(asrt_path.name_equals(atc_file_name)),
             asrt.equals(arg_1),
             asrt.equals(arg_2),
             asrt.equals(arg_3),
         ])
     )
     expectation = integration_check.Expectation(
         after_execution=ExecutedCommandAssertion(executor_that_records_arguments,
                                                  lambda tcds: expected_command)
     )
     # ACT & ASSERT #
     integration_check.check_execution(self,
                                       ACTOR_THAT_RUNS_PYTHON_PROGRAM_FILE,
                                       act_phase_instructions,
                                       arrangement,
                                       expectation)
Example #12
0
def arrangement_w_tcds(
    hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
    symbol_table: Optional[SymbolTable] = None,
    process_execution:
    ProcessExecutionArrangement = ProcessExecutionArrangement(
        process_execution_settings=proc_exe_env_for_test()),
    act_exe_input: AtcExeInputArr = AtcExeInputArr(),
    post_sds_action: PlainTcdsAction = PlainTcdsAction(),
    mem_buff_size: int = 2**10,
) -> Arrangement:
    return Arrangement(
        tcds=TcdsArrangementPreAct(
            hds_contents=hds_contents,
            post_population_action=post_sds_action,
        ),
        symbols=symbol_table,
        process_execution=process_execution,
        atc_exe_input=act_exe_input,
        mem_buff_size=mem_buff_size,
    )
 def runTest(self):
     # ARRANGE #
     program_symbol = ProgramSymbolContext.of_arbitrary_value('PROGRAM_SYMBOL')
     const_true_int_matcher_symbol = IntegerMatcherSymbolContext.of_primitive_constant(
         'CONST_TRUE_INT_MATCHER',
         result=True,
     )
     all_symbols = [program_symbol,
                    const_true_int_matcher_symbol,
                    ]
     hard_error_message = 'the err msg'
     # ACT & ASSERT #
     CHECKER.check__abs_stx(
         self,
         InstructionArguments(
             program_symbol.abstract_syntax,
             const_true_int_matcher_symbol.abstract_syntax,
         ),
         ArrangementPostAct2(
             symbols=SymbolContext.symbol_table_of_contexts(all_symbols),
             process_execution=ProcessExecutionArrangement(
                 os_services_access.new_for_cmd_exe(
                     CommandExecutorThatRaisesHardError(
                         asrt_text_doc.new_single_string_text_for_test(hard_error_message)
                     ),
                 ),
             ),
         ),
         Expectation2(
             ParseExpectation(
                 symbol_usages=SymbolContext.usages_assertion_of_contexts(all_symbols),
             ),
             ExecutionExpectation(
                 main_result=asrt_pfh.is_hard_error(
                     asrt_text_doc.is_string_for_test_that_equals(hard_error_message)
                 )
             ),
         )
     )
Example #14
0
 def runTest(self):
     # ARRANGE #
     program_symbol = ProgramSymbolContext.of_arbitrary_value(
         'PROGRAM_SYMBOL')
     const_true_int_matcher_symbol = IntegerMatcherSymbolContext.of_primitive_constant(
         'CONST_TRUE_INT_MATCHER',
         result=True,
     )
     string_transformer_that_reports_failure_if_applied = StringTransformerSymbolContext.of_primitive(
         'STRING_TRANSFORMER_THAT_MUST_NOT_BE_USED',
         StringTransformerThatFailsTestIfApplied(self))
     all_symbols = [
         program_symbol,
         string_transformer_that_reports_failure_if_applied,
         const_true_int_matcher_symbol,
     ]
     # ACT & ASSERT #
     CHECKER.check__abs_stx(
         self,
         InstructionArguments(
             FullProgramAbsStx(
                 program_symbol.abstract_syntax,
                 transformation=
                 string_transformer_that_reports_failure_if_applied.
                 abstract_syntax),
             const_true_int_matcher_symbol.abstract_syntax,
         ),
         ArrangementPostAct2(
             symbols=SymbolContext.symbol_table_of_contexts(all_symbols),
             process_execution=ProcessExecutionArrangement(
                 os_services_access.new_for_cmd_exe(
                     CommandExecutorThatJustReturnsConstant(1), ), ),
         ),
         Expectation2(
             ParseExpectation(
                 symbol_usages=SymbolContext.usages_assertion_of_contexts(
                     all_symbols), ),
             ExecutionExpectation(main_result=asrt_pfh.is_pass()),
         ))
Example #15
0
 def runTest(self):
     hard_error_message = 'the err msg'
     with self.config.program_that_exits_with_code(0) as setup:
         self._check(
             setup.act_phase_instructions,
             arrangement_w_tcds(
                 symbol_table=setup.symbols,
                 hds_contents=_hds_pop_of(setup),
                 process_execution=ProcessExecutionArrangement(
                     os_services=os_services_access.new_for_cmd_exe(
                         CommandExecutorThatRaisesHardError(
                             asrt_text_doc.new_single_string_text_for_test(
                                 hard_error_message))),
                     process_execution_settings=proc_exe_env_for_test(
                         environ=setup.environ),
                 )),
             expectation=Expectation.hard_error_from_execute(
                 symbol_usages=setup.symbol_usages,
                 error_message=asrt_text_doc.
                 is_single_pre_formatted_text_that_equals(
                     hard_error_message),
             ))
Example #16
0
 def runTest(self):
     var_name = 'This_Is_A_Test_Var_23026509234'
     var_value = str(random.getrandbits(32))
     with self.config.program_that_prints_value_of_environment_variable_to_stdout(
             var_name) as setup:
         environ = (dict(os.environ)
                    if setup.environ is None else setup.environ)
         environ[var_name] = var_value
         self._check(
             setup.act_phase_instructions,
             arrangement_w_tcds(
                 symbol_table=setup.symbols,
                 hds_contents=_hds_pop_of(setup),
                 process_execution=ProcessExecutionArrangement(
                     process_execution_settings=proc_exe_env_for_test()),
                 act_exe_input=AtcExeInputArr(environ=environ, ),
             ),
             Expectation(
                 symbol_usages=setup.symbol_usages,
                 post_sds=PostSdsExpectation.constant(
                     sub_process_result_from_execute=asrt_proc_result.
                     matches_proc_result(stdout=asrt.equals(var_value +
                                                            '\n')))),
         )
Example #17
0
def arrangement_w_tcds(
    tcds_contents: tcds_populators.TcdsPopulator = tcds_populators.empty(),
    hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
    non_hds_contents: non_hds_populator.NonHdsPopulator = non_hds_populator.
    empty(),
    act_result: Optional[ActResultProducer] = None,
    pre_population_action: PlainTcdsAction = PlainTcdsAction(),
    post_population_action: PlainTcdsAction = PlainTcdsAction(),
    symbols: Optional[SymbolTable] = None,
    process_execution:
    ProcessExecutionArrangement = ProcessExecutionArrangement(),
) -> Arrangement:
    """
    :return: An Arrangement with will create a TCDS
    """
    tcds = TcdsArrangement(
        hds_contents=hds_contents,
        non_hds_contents=non_hds_contents,
        tcds_contents=tcds_contents,
        act_result=act_result,
        pre_population_action=pre_population_action,
        post_population_action=post_population_action,
    )
    return Arrangement(symbols, tcds, process_execution)
Example #18
0
    def runTest(self):
        # ARRANGE #

        py_file = File('output-env-vars.py',
                       _PGM_THAT_OUTPUTS_ENVIRONMENT_VARS)

        py_file_rel_opt_conf = rel_opt.conf_rel_any(RelOptionType.REL_TMP)
        py_file_conf = py_file_rel_opt_conf.named_file_conf(py_file.name)

        program_symbol = ProgramSymbolContext.of_sdv(
            'PROGRAM_THAT_EXECUTES_PY_FILE',
            program_sdvs.interpret_py_source_file_that_must_exist(
                py_file_conf.path_sdv))
        environment_cases = [
            {
                '1': 'one',
            },
            {
                '1': 'one',
                '2': 'two',
            },
        ]

        for with_ignored_exit_code in [False, True]:
            with self.subTest(with_ignored_exit_code=with_ignored_exit_code):
                # ACT && ASSERT #

                integration_check.CHECKER__PARSE_FULL.check_multi(
                    self,
                    args.syntax_for_run(
                        program_args.symbol_ref_command_elements(
                            program_symbol.name),
                        ignore_exit_code=with_ignored_exit_code,
                    ),
                    ParseExpectation(
                        source=asrt_source.is_at_end_of_line(1),
                        symbol_references=program_symbol.references_assertion,
                    ),
                    model_constructor.arbitrary(self),
                    [
                        NExArr(
                            'Environment: {}'.format(repr(environment)),
                            PrimAndExeExpectation(
                                ExecutionExpectation(
                                    main_result=asrt_string_source.
                                    pre_post_freeze__matches_lines(
                                        _AssertLinesRepresentSubSetOfDict(
                                            environment),
                                        may_depend_on_external_resources=asrt.
                                        equals(True),
                                        frozen_may_depend_on_external_resources
                                        =asrt.anything_goes(),
                                    )),
                                prim_asrt__constant(
                                    asrt_string_transformer.
                                    is_identity_transformer(False)),
                            ),
                            arrangement_w_tcds(
                                tcds_contents=py_file_rel_opt_conf.
                                populator_for_relativity_option_root(
                                    DirContents([py_file])),
                                symbols=program_symbol.symbol_table,
                                process_execution=ProcessExecutionArrangement(
                                    process_execution_settings=
                                    ProcessExecutionSettings.with_environ(
                                        environment))))
                        for environment in environment_cases
                    ],
                )
Example #19
0
    def runTest(self):
        # ARRANGE #
        actor = sut.actor(COMMAND_THAT_RUNS_PYTHON_PROGRAM_FILE)

        exe_file = fs.python_executable_file(
            'program-name',
            py_programs.exit_with_0()
        )
        text_until_end_of_line = 'some {}invalidly quoted text'.format(SOFT_QUOTE_CHAR)

        existing_path_relativity = relativity_options.conf_rel_hds(RelHdsOptionType.REL_HDS_CASE)

        existing_path_argument = path_arguments.RelOptPathArgument(
            'existing-path',
            existing_path_relativity.relativity,
        )
        act_contents = ab.sequence__r([
            ab.singleton(exe_file.name),
            program_arguments.existing_path(
                existing_path_argument
            ),
            program_arguments.remaining_part_of_current_line_as_literal(text_until_end_of_line),
        ])

        def get_command_assertion(tcds: TestCaseDs) -> Assertion[Command]:
            symbols = SymbolTable.empty()
            return asrt_command.matches_command(
                asrt.anything_goes(),
                asrt.equals([
                    str(relativity_configurations.ATC_FILE
                        .named_file_conf(exe_file.name)
                        .path_sdv
                        .resolve(symbols)
                        .value_of_any_dependency__d(tcds)
                        .primitive
                        ),
                    str(existing_path_relativity
                        .named_file_conf(existing_path_argument.name)
                        .path_sdv
                        .resolve(symbols)
                        .value_of_any_dependency__d(tcds)
                        .primitive
                        ),
                    text_until_end_of_line,
                ])
            )

        act_instruction = instr([act_contents.as_str])
        executor_that_records_arguments = CommandExecutorThatRecordsArguments()
        # ACT & ASSERT #
        integration_check.check_execution(
            self,
            actor,
            [act_instruction],
            arrangement_w_tcds(
                process_execution=ProcessExecutionArrangement(
                    os_services=os_services_access.new_for_cmd_exe(executor_that_records_arguments)
                ),
                hds_contents=hds_populators.multiple([
                    relativity_configurations.ATC_FILE.populator_for_relativity_option_root__hds(
                        fs.DirContents([exe_file])
                    ),
                    existing_path_relativity.populator_for_relativity_option_root__hds(
                        fs.DirContents([fs.File.empty(existing_path_argument.name)])
                    ),
                ])
            ),
            Expectation(
                after_execution=ExecutedCommandAssertion(
                    executor_that_records_arguments,
                    get_command_assertion,
                )
            ),
        )
Example #20
0
    def runTest(self):
        # ARRANGE #
        actor = sut.actor(COMMAND_THAT_RUNS_PYTHON_PROGRAM_FILE)

        exe_file = fs.python_executable_file(
            'program-name',
            py_programs.exit_with_0()
        )
        argument_to_act_file = 'argument-to-act-file'
        act_contents = ab.sequence__r([
            ab.singleton(exe_file.name),
            ab.singleton(argument_to_act_file)
        ])
        interpreter_arguments_symbol = ListConstantSymbolContext('INTERPRETER_ARGS_LIST', ['1st', '2nd'])
        interpreter_arguments = ArgumentsSdv.new_without_validation(
            interpreter_arguments_symbol.sdv
        )
        actor = sut.actor(
            command_sdvs.for_executable_file(
                path_sdvs.constant(path_ddvs.absolute_file_name(sys.executable)),
                interpreter_arguments
            )
        )

        def get_command_assertion(tcds: TestCaseDs) -> Assertion[Command]:
            symbols = SymbolTable.empty()
            return asrt_command.matches_command(
                asrt.anything_goes(),
                asrt.equals(
                    interpreter_arguments_symbol.constant_list +
                    [
                        str(relativity_configurations.ATC_FILE
                            .named_file_conf(exe_file.name)
                            .path_sdv
                            .resolve(symbols)
                            .value_of_any_dependency__d(tcds)
                            .primitive
                            ),
                        argument_to_act_file,
                    ]
                )
            )

        act_instruction = instr([act_contents.as_str])
        executor_that_records_arguments = CommandExecutorThatRecordsArguments()
        # ACT & ASSERT #
        integration_check.check_execution(
            self,
            actor,
            [act_instruction],
            arrangement_w_tcds(
                process_execution=ProcessExecutionArrangement(
                    os_services=os_services_access.new_for_cmd_exe(executor_that_records_arguments)
                ),
                hds_contents=relativity_configurations.ATC_FILE.populator_for_relativity_option_root__hds(
                    fs.DirContents([exe_file])
                )
            ),
            Expectation(
                after_execution=ExecutedCommandAssertion(
                    executor_that_records_arguments,
                    get_command_assertion,
                )
            ),
        )
 def proc_exe_arr__w_settings_check(self) -> ProcessExecutionArrangement:
     return ProcessExecutionArrangement(
         self.os_services__w_settings_check,
         self._proc_exe_settings_w_expected_value(),
     )
Example #22
0
 def proc_exe_env__w_stdin_check(self) -> ProcessExecutionArrangement:
     return ProcessExecutionArrangement(self.os_services_w_stdin_check)