def new_processor( setup_phase_instructions: Dict[str, InstructionParser], test_case_processor_constructor: TestCaseProcessorConstructor, predefined_properties: PredefinedProperties) -> sut.Processor: test_case_definition = TestCaseDefinition( TestCaseParsingSetup(space_separator_instruction_name_extractor, instruction_setup(setup_phase_instructions), ActPhaseParser()), predefined_properties) default_configuration = processors.Configuration( test_case_definition, test_case_handling_setup_with_identity_preprocessor(), os_services_access.new_for_current_os(), 2**10, False, sandbox_dir_resolving.mk_tmp_dir_with_prefix('test-suite-')) return sut.Processor( default_configuration, suite_hierarchy_reading.Reader( suite_hierarchy_reading.Environment( SectionElementParserThatRaisesRecognizedSectionElementSourceError( ), test_case_definition.parsing_setup, default_configuration.default_handling_setup)), ExecutionTracingProcessingReporter(), enumeration.DepthFirstEnumerator(), test_case_processor_constructor, )
def _new_processor( self, recording_media: List[Recording], test_case_processor_constructor: TestCaseProcessorConstructor ) -> sut.Processor: test_case_definition = TestCaseDefinition( TestCaseParsingSetup( space_separator_instruction_name_extractor, self._phase_config().instructions_setup( REGISTER_INSTRUCTION_NAME, recording_media), self._phase_config().act_phase_parser()), _predefined_properties.new_empty()) default_case_configuration = processors.Configuration( test_case_definition, TestCaseHandlingSetup( ActPhaseSetup('recording actor', self._phase_config().actor(recording_media)), IDENTITY_PREPROCESSOR), os_services_access.new_for_current_os(), 2**10, False, sandbox_dir_resolving.mk_tmp_dir_with_prefix('test-suite-')) return sut.Processor( default_case_configuration, suite_hierarchy_reading.Reader( suite_hierarchy_reading.Environment( SectionElementParserThatRaisesUnrecognizedSectionElementSourceError( ), test_case_definition.parsing_setup, default_case_configuration.default_handling_setup)), ProcessingReporterThatDoesNothing(), enumeration.DepthFirstEnumerator(), test_case_processor_constructor, )
def _configuration_for_cases_in_suite( self, suite: structure.TestSuiteHierarchy ) -> case_processing.Configuration: return case_processing.Configuration( self._default_case_configuration.test_case_definition, suite.test_case_handling_setup, self._default_case_configuration.os_services, self._default_case_configuration.mem_buff_size, self._default_case_configuration.is_keep_sandbox, self._default_case_configuration.sandbox_root_dir_resolver)
def configuration_for_instruction_set( instruction_set: InstructionsSetup) -> sut.Configuration: tc_parsing_setup = TestCaseParsingSetup( first_space_separated_string_extractor, instruction_set, ActPhaseParser()) tc_definition = TestCaseDefinition(tc_parsing_setup, _predefined_properties.new_empty()) tc_handling_setup = setup_with_null_act_phase_and_null_preprocessing() return sut.Configuration( tc_definition, tc_handling_setup, os_services_access.new_for_current_os(), 2**10, is_keep_sandbox=False, )
def execute_test_suite( self, settings: TestSuiteExecutionSettings, ) -> ProcessResultReporter: from exactly_lib.processing import processors from exactly_lib.test_suite import enumeration from exactly_lib.test_suite.file_reading import suite_hierarchy_reading from exactly_lib.test_suite import processing default_configuration = processors.Configuration( self._test_case_definition, settings.handling_setup, _resolve_os_services(), self._mem_buff_size, False, self._test_suite_definition.sandbox_root_dir_sdv) processor = processing.Processor( default_configuration, suite_hierarchy_reading.Reader( suite_hierarchy_reading.Environment( self._test_suite_definition.configuration_section_parser, self._test_case_definition.parsing_setup, default_configuration.default_handling_setup)), settings.processing_reporter, enumeration.DepthFirstEnumerator(), processors.new_processor_that_should_not_pollute_current_process) return processor.process_reporter(settings.suite_root_file_path)
def _default_case_configuration( test_case_handling_setup: TestCaseHandlingSetup ) -> case_processing.Configuration: return case_processing.Configuration( _DEFAULT_TEST_CASE_DEFINITION, test_case_handling_setup, os_services_access.new_for_current_os(), 2**10, False)
Only TestCaseSetup:s that are included in this association (dict) can be executed. """ def __init__(self, test_case_id_2_result: Dict[int, tcp.Result]): self.test_case_id_2_result = test_case_id_2_result def apply(self, test_case: TestCaseFileReference) -> tcp.Result: return self.test_case_id_2_result[id(test_case)] DUMMY_TEST_CASE_DEFINITION = test_case_definition_with_no_instructions_and_no_preprocessor( ) DUMMY_CASE_PROCESSING = case_processing.Configuration( DUMMY_TEST_CASE_DEFINITION, test_case_handling_setup_with_identity_preprocessor(), os_services_access.new_for_cmd_exe( CommandExecutorThatJustReturnsConstant()), 2**10, False, ) FULL_RESULT_PASS = new_pass(DUMMY_SDS, ActionToCheckOutcome(0)) FULL_RESULT_SKIP = new_skipped() FULL_RESULT_FAIL = full_result_with_failure_info(FullExeResultStatus.FAIL) T_C_H_S = test_case_handling_setup_with_identity_preprocessor() def test_suite( source_file_name: str, sub_test_suites: List[structure.TestSuiteHierarchy], test_cases: List[TestCaseFileReference]