Beispiel #1
0
 def __init__(self,
              pre_contents_population_action: TcdsAction = TcdsAction(),
              hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
              sds_contents: sds_populator.SdsPopulator = sds_populator.empty(),
              non_hds_contents: non_hds_populator.NonHdsPopulator = non_hds_populator.empty(),
              tcds_contents: tcds_populators.TcdsPopulator = tcds_populators.empty(),
              os_services: OsServices = os_services_access.new_for_current_os(),
              process_execution_settings: ProcessExecutionSettings = proc_exe_env_for_test(),
              default_environ_getter: DefaultEnvironGetter = get_empty_environ,
              post_sds_population_action: TcdsAction = TcdsAction(),
              symbols: SymbolTable = None,
              fs_location_info: FileSystemLocationInfo = ARBITRARY_FS_LOCATION_INFO,
              ):
     super().__init__(hds_contents=hds_contents,
                      process_execution_settings=process_execution_settings,
                      default_environ_getter=default_environ_getter)
     self.pre_contents_population_action = pre_contents_population_action
     self.sds_contents = sds_contents
     self.non_hds_contents = non_hds_contents
     self.tcds_contents = tcds_contents
     self.post_sds_population_action = post_sds_population_action
     self.os_services = os_services
     self.process_execution_settings = process_execution_settings
     self.symbols = symbol_table_from_none_or_value(symbols)
     self.fs_location_info = fs_location_info
Beispiel #2
0
 def __init__(self,
              pre_contents_population_action: TcdsAction = TcdsAction(),
              hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
              sds_contents: sds_populator.SdsPopulator = sds_populator.empty(),
              non_hds_contents: non_hds_populator.NonHdsPopulator = non_hds_populator.empty(),
              tcds_contents: tcds_populators.TcdsPopulator = tcds_populators.empty(),
              post_sds_population_action: TcdsAction = TcdsAction(),
              act_result_producer: ActResultProducer = ActResultProducerFromActResult(),
              os_services: OsServices = os_services_access.new_for_current_os(),
              process_execution_settings: ProcessExecutionSettings = ProcessExecutionSettings.null(),
              default_environ_getter: DefaultEnvironGetter = get_empty_environ,
              symbols: SymbolTable = None,
              fs_location_info: FileSystemLocationInfo = ARBITRARY_FS_LOCATION_INFO,
              ):
     super().__init__(pre_contents_population_action=pre_contents_population_action,
                      sds_contents=sds_contents,
                      hds_contents=hds_contents,
                      non_hds_contents=non_hds_contents,
                      tcds_contents=tcds_contents,
                      post_sds_population_action=post_sds_population_action,
                      os_services=os_services,
                      process_execution_settings=process_execution_settings,
                      default_environ_getter=default_environ_getter,
                      symbols=symbols,
                      fs_location_info=fs_location_info)
     self.act_result_producer = act_result_producer
Beispiel #3
0
 def __init__(self,
              pre_contents_population_action: TcdsAction = TcdsAction(),
              hds_contents_before: hds_populators.
              HdsPopulator = hds_populators.empty(),
              sds_contents_before: sds_populator.
              SdsPopulator = sds_populator.empty(),
              pre_action_action: TcdsAction = TcdsAction(),
              symbols: SymbolTable = None):
     self.pre_contents_population_action = pre_contents_population_action
     self.hds_contents_before = hds_contents_before
     self.sds_contents_before = sds_contents_before
     self.pre_action_action = pre_action_action
     self.symbols = symbol_table_from_none_or_value(symbols)
Beispiel #4
0
 def __init__(
     self,
     pre_contents_population_action: TcdsAction = TcdsAction(),
     hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
     sds_contents_before_main: sds_populator.SdsPopulator = sds_populator.
     empty(),
     non_hds_contents_before_main: non_hds_populator.
     NonHdsPopulator = non_hds_populator.empty(),
     tcds_contents: tcds_populators.TcdsPopulator = tcds_populators.empty(),
     os_services: OsServices = new_for_current_os(),
     process_execution_settings:
     ProcessExecutionSettings = ProcessExecutionSettings.null(),
     default_environ_getter: DefaultEnvironGetter = get_empty_environ,
     previous_phase: PreviousPhase = PreviousPhase.ASSERT,
     symbols: SymbolTable = None,
     fs_location_info: FileSystemLocationInfo = ARBITRARY_FS_LOCATION_INFO,
 ):
     super().__init__(
         pre_contents_population_action=pre_contents_population_action,
         hds_contents=hds_contents,
         sds_contents=sds_contents_before_main,
         non_hds_contents=non_hds_contents_before_main,
         tcds_contents=tcds_contents,
         os_services=os_services,
         process_execution_settings=process_execution_settings,
         default_environ_getter=default_environ_getter,
         symbols=symbols,
         fs_location_info=fs_location_info)
     self.previous_phase = previous_phase
def arrangement(
    pre_contents_population_action: TcdsAction = TcdsAction(),
    hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
    sds_contents_before_main: sds_populator.SdsPopulator = sds_populator.empty(
    ),
    non_hds_contents_before_main: non_hds_populator.
    NonHdsPopulator = non_hds_populator.empty(),
    tcds_contents: tcds_populators.TcdsPopulator = tcds_populators.empty(),
    act_result_producer: ActResultProducer = ActResultProducerFromActResult(),
    os_services: OsServices = new_for_current_os(),
    process_execution_settings:
    ProcessExecutionSettings = ProcessExecutionSettings.null(),
    default_environ_getter: DefaultEnvironGetter = get_empty_environ,
    symbols: SymbolTable = None,
) -> ArrangementPostAct:
    return ArrangementPostAct(
        pre_contents_population_action=pre_contents_population_action,
        hds_contents=hds_contents,
        sds_contents=sds_contents_before_main,
        non_hds_contents=non_hds_contents_before_main,
        tcds_contents=tcds_contents,
        act_result_producer=act_result_producer,
        os_services=os_services,
        process_execution_settings=process_execution_settings,
        default_environ_getter=default_environ_getter,
        symbols=symbols)
Beispiel #6
0
 def arrangement_for_contents(self,
                              actual_contents: str,
                              post_sds_population_action: TcdsAction = TcdsAction(),
                              tcds_contents: tcds.TcdsPopulator = tcds.empty(),
                              symbols: SymbolTable = None,
                              ) -> instruction_check.ArrangementPostAct:
     raise NotImplementedError()
Beispiel #7
0
 def __init__(
     self,
     pre_contents_population_action: TcdsAction = TcdsAction(),
     hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
     sds_contents_before_main: sds_populator.SdsPopulator = sds_populator.
     empty(),
     non_hds_contents: non_hds_populator.
     NonHdsPopulator = non_hds_populator.empty(),
     tcds_contents: tcds_populators.TcdsPopulator = tcds_populators.empty(),
     os_services: OsServices = os_services_access.new_for_current_os(),
     process_execution_settings:
     ProcessExecutionSettings = ProcessExecutionSettings.null(),
     default_environ_getter: DefaultEnvironGetter = get_empty_environ,
     settings_builder: Optional[SetupSettingsBuilder] = None,
     symbols: SymbolTable = None,
     fs_location_info: FileSystemLocationInfo = ARBITRARY_FS_LOCATION_INFO,
 ):
     super().__init__(
         pre_contents_population_action=pre_contents_population_action,
         hds_contents=hds_contents,
         sds_contents=sds_contents_before_main,
         non_hds_contents=non_hds_contents,
         tcds_contents=tcds_contents,
         os_services=os_services,
         process_execution_settings=process_execution_settings,
         default_environ_getter=default_environ_getter,
         symbols=symbols,
         fs_location_info=fs_location_info,
     )
     self.initial_settings_builder = settings_handlers.builder_from_optional(
         settings_builder)
 def arrangement_for_contents(self,
                              actual_contents: str,
                              post_sds_population_action: TcdsAction = TcdsAction(),
                              tcds_contents: tcds.TcdsPopulator = tcds.empty(),
                              symbols: SymbolTable = None,
                              ) -> instruction_check.ArrangementPostAct:
     return instruction_check.ArrangementPostAct(
         sds_contents=self._populator_for_actual(actual_contents),
         tcds_contents=tcds_contents,
         post_sds_population_action=post_sds_population_action,
         symbols=symbols,
     )
Beispiel #9
0
 def arrangement(
         self,
         pre_contents_population_action: TcdsAction = TcdsAction(),
         hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
         sds_contents_before_main: sds_populator.
     SdsPopulator = sds_populator.empty(),
         tcds_contents: tcds_populators.TcdsPopulator = tcds_populators.
     empty(),
         environ: Optional[Dict[str, str]] = None,
         default_environ_getter: DefaultEnvironGetter = get_empty_environ,
         os_services: OsServices = new_for_current_os(),
         symbols: SymbolTable = None):
     raise NotImplementedError()
Beispiel #10
0
 def arrangement(self,
                 pre_contents_population_action: TcdsAction = TcdsAction(),
                 hds_contents: hds_populators.HdsPopulator = hds_populators.empty(),
                 sds_contents_before_main: sds_populator.SdsPopulator = sds_populator.empty(),
                 tcds_contents: tcds_populators.TcdsPopulator = tcds_populators.empty(),
                 environ: Optional[Dict[str, str]] = None,
                 default_environ_getter: DefaultEnvironGetter = get_empty_environ,
                 os_services: OsServices = new_for_current_os(),
                 symbols: SymbolTable = None):
     return ic.Arrangement(pre_contents_population_action=pre_contents_population_action,
                           hds_contents=hds_contents,
                           sds_contents_before_main=sds_contents_before_main,
                           tcds_contents=tcds_contents,
                           process_execution_settings=ProcessExecutionSettings.from_non_immutable(environ=environ),
                           default_environ_getter=default_environ_getter,
                           os_services=os_services,
                           symbols=symbols)
Beispiel #11
0
def check(put: unittest.TestCase, action: TcdsAction, arrangement: Arrangement,
          expectation: Expectation):
    with tcds_with_act_as_curr_dir(
            pre_contents_population_action=arrangement.
            pre_contents_population_action,
            hds_contents=arrangement.hds_contents_before,
            sds_contents=arrangement.sds_contents_before,
            symbols=arrangement.symbols,
    ) as environment:
        arrangement.pre_action_action.apply(environment)
        try:
            result = action.apply(environment)
        except HardErrorException as ex:
            if expectation.acton_raises_hard_error:
                text_doc_assertions.assert_is_valid_text_renderer(
                    put, ex.error)
        else:
            if expectation.acton_raises_hard_error:
                put.fail('action does not raise {}'.format(HardErrorException))

            expectation.expected_action_result.apply(put, result)

        expectation.expected_sds_contents_after.apply(put, environment.sds)
        expectation.post_action_check.apply(put, environment.tcds)