def test_symlink(self): link_target = 'link-target-file' file_to_check = 'file-to-check' cases = [ NEA('match: symlink to regular', True, DirContents([File.empty(link_target), sym_link(file_to_check, link_target)]), ), NEA('match: symlink to directory', True, DirContents([Dir.empty(link_target), sym_link(file_to_check, link_target)]), ), NEA('match: broken symlink', True, DirContents([sym_link(file_to_check, 'non-existing-target-file')]), ), NEA('not match: actual is regular', False, DirContents([File.empty(file_to_check)]), ), ] for case in cases: with self.subTest(case_name=case.name): self._check(file_type_to_check_for=FileType.SYMLINK, expected_result=case.expected, base_name_of_file_to_check=file_to_check, dir_contents=case.actual)
def test_destination_already_exists_in_destination_directory(self): src = 'src-file-name' dst = 'dst-dir-name' home_dir_contents = DirContents([(File.empty(src))]) cwd_dir_contents = DirContents([Dir(dst, [File.empty(src)])]) for parser_case in _EXECUTION_CHECKERS: with self.subTest(parser=parser_case.name): # ACT & ASSERT # parser_case.value.check( self, args.copy( defs.DEFAULT_SRC_REL_OPT.path_argument_of_rel_name(src), defs.DEFAULT_DST_REL_OPT.path_argument_of_rel_name(dst) ).as_remaining_source, Arrangement.phase_agnostic( tcds=TcdsArrangement( pre_population_action=MAKE_SUB_DIR_OF_SDS_CURRENT_DIRECTORY, hds_contents=defs.DEFAULT_SRC_REL_OPT.populator_for_relativity_option_root__hds( home_dir_contents), sds_contents=defs.DEFAULT_DST_REL_OPT.populator_for_relativity_option_root__sds( cwd_dir_contents ), ) ), Expectation.phase_agnostic( main_result=asrt_text_doc.is_any_text(), ), )
def test_directory(self): dir_to_check = 'dir-to-check' cases = [ NEA('match', True, DirContents([Dir.empty(dir_to_check)]), ), NEA('match: symlink to directory', True, DirContents([Dir.empty('the dir'), sym_link(dir_to_check, 'the dir')]), ), NEA('not match: actual is regular', False, DirContents([File.empty(dir_to_check)]), ), NEA('not match: actual is broken symlink', False, DirContents([File.empty('the file.txt'), sym_link(dir_to_check, 'name-of-non-existing-file')]), ), ] for case in cases: with self.subTest(case_name=case.name): self._check(file_type_to_check_for=FileType.DIRECTORY, expected_result=case.expected, base_name_of_file_to_check=dir_to_check, dir_contents=case.actual)
def test_destination_already_exists__without_explicit_destination(self): # ARRANGE # file_name = 'existing-file' file_to_install = DirContents([(File(file_name, 'contents'))]) for parser_case in _EXECUTION_CHECKERS: with self.subTest(parser=parser_case.name): # ACT & ASSERT # parser_case.value.check( self, args.copy( defs.DEFAULT_SRC_REL_OPT.path_argument_of_rel_name(file_name) ).as_remaining_source, Arrangement.phase_agnostic( tcds=TcdsArrangement( pre_population_action=MAKE_SUB_DIR_OF_SDS_CURRENT_DIRECTORY, hds_contents=defs.DEFAULT_SRC_REL_OPT.populator_for_relativity_option_root__hds( file_to_install), sds_contents=defs.DEFAULT_DST_REL_OPT.populator_for_relativity_option_root__sds( DirContents([File.empty(file_name)]) ), ) ), Expectation.phase_agnostic_2( main_result=asrt_text_doc.is_any_text(), ) )
def tmp_dir_as_cwd(contents: DirContents = empty_dir_contents()) -> pathlib.Path: with tempfile.TemporaryDirectory() as dir_name: with preserved_cwd(): dir_path = resolved_path(dir_name) os.chdir(str(dir_path)) contents.write_to(dir_path) yield dir_path
def test_file_exists(self): # ARRANGE # file_name = 'existing-file' instruction_argument_constructor = ArgumentsConstructorWithFileMatcher(file_name) cases_with_existing_file_of_different_types = [ NameAndValue( 'dir', DirContents([Dir.empty(file_name)])), NameAndValue( 'regular file', DirContents([File.empty(file_name)])), NameAndValue( 'sym-link', DirContents( [Dir.empty('directory'), Link(file_name, 'directory')]) ), NameAndValue( 'broken sym-link', DirContents( [Link(file_name, 'non-existing-target-file')]) ), ] self.checker.check_multiple_cases_with_rel_opt_variants_and_expectation_type_variants( cases_with_existing_file_of_different_types, instruction_argument_constructor, main_result_for_positive_expectation=PassOrFail.PASS, )
def tmp_dir_as_cwd(contents: DirContents = empty_dir_contents() ) -> ContextManager[pathlib.Path]: with temp_dir() as dir_path: with preserved_cwd(): os.chdir(str(dir_path)) contents.write_to(dir_path) yield dir_path
def test_copy_file__non_existing_destination(self): dst_file_name = 'dst-file_name-file.txt' sub_dir_name = 'src-sub-dir' source_file_contents = 'contents' src_file = File('src-file_name-file.txt', source_file_contents) home_dir_contents_cases = [ (src_file.file_name, DirContents([src_file])), (str(PurePosixPath(sub_dir_name) / src_file.file_name), DirContents([Dir(sub_dir_name, [src_file]) ])), ] expected_destination_dir_contents = DirContents([File(dst_file_name, src_file.contents)]) for src_rel_option in source_relativity_options__hds(): for dst_rel_option in destination_relativity_options(): for src_argument, home_dir_contents in home_dir_contents_cases: self._sub_test__copy_file( src_rel_option=src_rel_option, dst_rel_option=dst_rel_option, src_file_name=src_argument, dst_file_name=dst_file_name, hds_contents=src_rel_option.populator_for_relativity_option_root__hds(home_dir_contents), sds_populator_before_main=sds_populator.empty(), expected_destination_dir_contents=expected_destination_dir_contents, )
def test_copy_file__destination_is_existing_directory(self): # ARRANGE # src = 'src-file' dst = 'dst-dir' file_to_install = File(src, 'contents') home_dir_contents = [file_to_install] act_dir_contents = [Dir.empty(dst)] act_dir_contents_after = [Dir(dst, [file_to_install])] for parser_case in _EXECUTION_CHECKERS: with self.subTest(parser=parser_case.name): # ACT & ASSERT # parser_case.value.check__w_source_variants( self, args.copy( defs.DEFAULT_SRC_REL_OPT.path_argument_of_rel_name(src), defs.DEFAULT_DST_REL_OPT.path_argument_of_rel_name(dst) ).as_str, Arrangement.phase_agnostic( tcds=TcdsArrangement( pre_population_action=MAKE_SUB_DIR_OF_SDS_CURRENT_DIRECTORY, hds_contents=defs.DEFAULT_SRC_REL_OPT.populator_for_relativity_option_root__hds( DirContents(home_dir_contents) ), sds_contents=defs.DEFAULT_DST_REL_OPT.populator_for_relativity_option_root__sds( DirContents(act_dir_contents) ), ), ), MultiSourceExpectation.phase_agnostic( main_side_effects_on_sds=sds_contents_check.cwd_contains_exactly( DirContents(act_dir_contents_after)) ), )
def single_dir_setup(contents: DirContents = empty_dir_contents() ) -> SingleDirSetup: action_dir = Dir('act', contents.file_system_elements) tmp_dir_contents = DirContents([action_dir]) with tempfile.TemporaryDirectory() as dir_name: dir_path = resolved_path(dir_name) tmp_dir_contents.write_to(dir_path) yield SingleDirSetup(dir_path / action_dir.name, )
def tmp_dir_in_path_with_files( files: DirContents) -> ContextManager[Dict[str, str]]: with tempfile.TemporaryDirectory( prefix=program_info.PROGRAM_NAME) as tmp_dir_name: environ = dict(os.environ) environ['PATH'] = os.pathsep.join((tmp_dir_name, environ['PATH'])) files.write_to(pathlib.Path(tmp_dir_name)) yield environ
def _run(self, test_case_runner: TestCaseRunner, suite_file_name: str, suite_file_overriding: Optional[Path]): # ARRANGE # expected_instruction_recording = [ # First test case SETUP_INSTRUCTION_IN_CONTAINING_SUITE, SETUP_INSTRUCTION_IN_CASE, ] suite_file = File( suite_file_name, SUITE_WITH_SETUP_INSTRUCTION.format( marker=SETUP_INSTRUCTION_IN_CONTAINING_SUITE)) case_file = File( 'test.case', CASE_THAT_REGISTERS_MARKER.format( marker=SETUP_INSTRUCTION_IN_CASE)) sub_dir_path = Path('dir-containing-test-case') suite_and_case_files = DirContents([ suite_file, case_file, ]) explicit_suite_file_path = None if suite_file_overriding: explicit_suite_file_path = sub_dir_path / suite_file_overriding recording_media = [] test_case_parsing_setup = TestCaseParsingSetup( space_separator_instruction_name_extractor, instruction_setup_with_setup_instructions( REGISTER_INSTRUCTION_NAME, recording_media), ActPhaseParser()) test_case_handling_setup = test_case_handling_setup_with_identity_preprocessor( ) test_suite_definition = test_suite_definition_without_instructions() # ACT # with tmp_dir_as_cwd(suite_and_case_files.in_dir_path(sub_dir_path)): actual_result = test_case_runner.run( test_case_parsing_setup, test_case_handling_setup, test_suite_definition, sub_dir_path / case_file.name_as_path, explicit_suite_file_path) # ASSERT # self.assertEqual(exit_values.EXECUTION__PASS.exit_code, actual_result.exitcode, 'Sanity check of result indicator') recordings = list(map(Recording.string.fget, recording_media)) self.assertEqual(expected_instruction_recording, recordings)
def test_successful_parse_and_application_of_non_trivial_matcher(self): # ARRANGE # defined_name = 'defined_name' expected_container = matches_container( asrt.equals(ValueType.FILES_MATCHER), type_sdv_assertions.matches_sdv_of_files_matcher() ) not_num_files_beginning_with_a_eq_1_arg = self._not_num_files_beginning_with_a_eq_1_arg() cases = [ NEA('should match', expected=matcher_assertions.is_matching_success(), actual=DirContents([ File.empty('a.x'), File.empty('a.y'), File.empty('b.x'), File.empty('b.y'), ]) ), NEA('should not match', expected=matcher_assertions.is_arbitrary_matching_failure(), actual=DirContents([ File.empty('a.x'), File.empty('b.y'), File.empty('b.x'), ]) ), ] for case in cases: source = single_line_source( src2(ValueType.FILES_MATCHER, defined_name, not_num_files_beginning_with_a_eq_1_arg), ) expectation = Expectation.phase_agnostic( symbol_usages=asrt.matches_sequence([ asrt_sym_usage.matches_definition(asrt.equals(defined_name), expected_container) ]), symbols_after_main=assert_symbol_table_is_singleton( defined_name, expected_container, ), instruction_environment= AssertApplicationOfMatcherInSymbolTable(defined_name, actual_dir_contents=case.actual, expected_matcher_result=case.expected), )
def test_definition_and_reference_in_definition(self): leaf_name = 'LEAF_SYMBOL_SYMBOL' referrer_name = 'REFERRER_SYMBOL' case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(leaf_name, 'value'), sym_def.define_string( referrer_name, symbol_reference_syntax_for_name(leaf_name)), ])) check_case_and_suite( self, symbol_command_arguments=[case_with_single_def.name], arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(leaf_name, ValueType.STRING, num_refs=1), output.SymbolSummary(referrer_name, ValueType.STRING, num_refs=0), ])), ))
def test_single_definition_with_single_reference_in_act_phase__with_actor_set_in_conf( self): symbol_name = 'STRING_SYMBOL' case_with_single_def = File( 'test.xly', lines_content([ phase_names.CONFIGURATION.syntax, sym_def.SET_ACTOR_THAT_PARSES_REFERENCES_INSTRUCTION_NAME, phase_names.SETUP.syntax, sym_def.define_string(symbol_name, 'value'), phase_names.ACT.syntax, sym_def.reference_to(symbol_name, ValueType.STRING), ])) check_case_and_suite( self, symbol_command_arguments=[case_with_single_def.name], arrangement=Arrangement( main_program_config=sym_def.main_program_config( ActorThatRaisesParseException()), cwd_contents=DirContents([ case_with_single_def, ]), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(symbol_name, ValueType.STRING, num_refs=1), ])), ))
def test_single_definition_with_reference_to_builtin_symbol(self): builtin_symbol = StringSymbolContext.of_constant( 'BUILTIN_STRING_SYMBOL', 'builtin string symbol value') user_defined_symbol_name = 'STRING_SYMBOL' case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string( user_defined_symbol_name, symbol_reference_syntax_for_name(builtin_symbol.name)), ])) check_case_and_suite( self, symbol_command_arguments=[case_with_single_def.name], arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config( builtin_symbols=[ sym_def.builtin_symbol(builtin_symbol), ]), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( output.list_of([ output.SymbolSummary(user_defined_symbol_name, ValueType.STRING, num_refs=0), ])), ))
def test_relative_path_to_root_file_in_sub_dir_of_cwd(self): # ARRANGE # root_file_sub_dir_path = Path('sub-dir') root_file_in_sub_dir = file_with_lines('root-file-base-name.src', [ phase_names.CONFIGURATION.syntax, INSTR_THAT_ASSERTS_SOURCE_INFO_MATCHES_LOCATION, ]) cwd_dir_contents = DirContents([ Dir(str(root_file_sub_dir_path), [ root_file_in_sub_dir, ]) ]) file_arg_to_parser_rel_cwd = root_file_sub_dir_path / root_file_in_sub_dir.name with tmp_dir_as_cwd(cwd_dir_contents) as abs_cwd_dir_path: instruction_parser_file_loc_assertion = matches_file_location_info( abs_path_of_dir_containing_first_file_path=asrt.equals(abs_cwd_dir_path), file_path_rel_referrer=asrt.equals(file_arg_to_parser_rel_cwd), file_inclusion_chain=asrt.is_empty_sequence, ) # ACT & ASSERT # fail_if_test_case_does_not_pass( self, file_arg_to_parser_rel_cwd, test_case_definition_with_config_phase_assertion_instruction(self, instruction_parser_file_loc_assertion))
def file_structure(self, root_path: pathlib.Path) -> DirContents: return DirContents([ File('main.suite', lines_content(['[suites]', '?'])), File.empty('1'), Dir('2', []), File.empty('3'), ])
def _check(self, expected_contents: str, actual_contents: str, may_depend_on_external_resources: bool, expected_result: bool, ): expected_file_relativity = rel_opt.conf_rel_any(RelOptionType.REL_HDS_CASE) expected_contents_file = File('expected.txt', expected_contents) integration_check.CHECKER__PARSE_SIMPLE.check( self, args2.Equals.eq_file( expected_file_relativity.path_argument_of_rel_name(expected_contents_file.name) ).as_remaining_source, model_constructor.of_str(self, actual_contents, may_depend_on_external_resources=may_depend_on_external_resources), arrangement_w_tcds( tcds_contents=expected_file_relativity.populator_for_relativity_option_root( DirContents([expected_contents_file]) ) ), Expectation( execution=ExecutionExpectation( main_result=asrt_matching_result.matches_value( expected_result ) ), ), )
def dir_with_symlink_to_existing_dir() -> pathlib.Path: with tmp_dir( DirContents([ Dir.empty('existing-dir'), sym_link('existing-symlink', 'existing-dir') ])) as dir_path: yield dir_path / 'existing-symlink'
def runTest(self): # ARRANGE # checked_dir = Dir.empty('the-checked-dir') fsm_1 = FilesMatcherSymbolContextOfPrimitiveConstant('fsm_1', True) fsm_2 = FilesMatcherSymbolContextOfPrimitiveConstant('fsm_2', False) symbols = [fsm_1, fsm_2] rel_conf = rel_opt_conf.conf_rel_any(RelOptionType.REL_ACT) arguments = args.recursive( rel_conf.path_argument_of_rel_name(checked_dir.name), fsm_args.disjunction([fsm_1.argument, fsm_2.argument]), ) is_pass = fsm_1.result_value or fsm_2.result_value # ACT # & ASSERT # INSTRUCTION_CHECKER.check_2( self, arguments.as_remaining_source, ArrangementPostAct2( symbols=SymbolContext.symbol_table_of_contexts(symbols), tcds=TcdsArrangementPostAct( tcds_contents=rel_conf. populator_for_relativity_option_root( DirContents([checked_dir])))), Expectation2( ParseExpectation( source=asrt_source.source_is_at_end, symbol_usages=SymbolContext.usages_assertion_of_contexts( symbols), ), ExecutionExpectation( main_result=asrt_pfh.is_non_hard_error(is_pass), ), ))
def _populate_act_dir(self, act_environment: ActEnvironment): actual_contents = self.tcds_2_str(act_environment.tcds) sds_pop = sds_populator.contents_in(RelSdsOptionType.REL_ACT, DirContents([ File(self.file_name, actual_contents) ])) sds_pop.populate_sds(act_environment.tcds.sds)
def test_that_value_set_in_first_case_does_not_leak_to_second_case(self): # ARRANGE # containing_suite_file = File('test.suite', SUITE_WITH_CASES) suite_and_case_files = DirContents([ containing_suite_file, CASE_1_FILE, CASE_2_FILE, ]) case_processors = [ NameAndValue('processor_that_should_not_pollute_current_process', processors.new_processor_that_should_not_pollute_current_process), NameAndValue('processor_that_is_allowed_to_pollute_current_process', processors.new_processor_that_is_allowed_to_pollute_current_process), ] with tmp_dir(suite_and_case_files) as tmp_dir_path: suite_file_path = tmp_dir_path / containing_suite_file.file_name for case_processor_case in case_processors: with self.subTest(case_processor_case.name): registry = tr.Registry() processor = new_processor_with_no_env_vars(registry, case_processor_case.value) # ACT # return_value = processor.process(suite_file_path, StringStdOutFiles().reporting_environment) # ASSERT # self.assertEqual(ExecutionTracingRootSuiteReporter.VALID_SUITE_EXIT_CODE, return_value, 'Sanity check of result indicator') self.assertFalse(registry.observation)
def runTest(self): # ARRANGE # files_matcher_name = 'the_files_matcher' checked_dir_location = RelSdsOptionType.REL_TMP checked_dir = Dir.empty('checked-dir') # ACT & ASSERT # integration_check.CHECKER__PARSE_FULL.check_multi__w_source_variants( self, arguments=args.DirContents( fsm_args.SymbolReference(files_matcher_name)).as_arguments, input_=integration_check.file_in_sds(checked_dir_location, checked_dir.name), symbol_references=asrt.matches_singleton_sequence( is_reference_to_files_matcher(files_matcher_name)), execution=[ NExArr( 'checked dir is empty', PrimAndExeExpectation.of_exe( main_result=asrt_matching_result.matches_value( matcher_result)), arrangement_w_tcds( non_hds_contents=sds_populator.contents_in( checked_dir_location, DirContents([checked_dir])), symbols=FilesMatcherSymbolContext. of_primitive_constant(files_matcher_name, matcher_result).symbol_table, ), ) for matcher_result in [False, True] ], )
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 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))))
def test_succeed(self): # ARRANGE # existing_dir = Dir.empty('a-dir') cwd_contents = DirContents([existing_dir]) cases = [ NameAndValue( 'existing dir', existing_dir.name_as_path, ), NameAndValue( 'non-existing dir', existing_dir.name_as_path / 'non-existing', ), NameAndValue( 'non-existing dir / multiple non-existing path components', existing_dir.name_as_path / 'non-existing-1' / 'non-existing-2', ), ] with tmp_dir.tmp_dir_as_cwd(cwd_contents): for case in cases: with self.subTest(case.name): path = case.value # ACT # sut.ensure_directory_exists(path) # ASSERT # self.assertTrue(path.is_dir())
def test_fail_WHEN_actor_argument_is_empty(self): empty_suite_file = File.empty('test.suite') self._expect_raise_argument_parsing_error( cwd_contents=DirContents([empty_suite_file]), arguments=[ common_cli_options.OPTION_FOR_ACTOR, '', empty_suite_file.name ])
def test_succeed_WHEN_file_argument_do_exit(self): existing_file = File.empty('existing-file.ext') self._expect_successful_parse( cwd_contents=DirContents([existing_file]), arguments=[existing_file.name], expected_file_path=existing_file.name_as_path, )
def test(self): name_of_existing_symbol = 'STRING_SYMBOL' not_the_name_of_an_existing_symbol = 'NON_EXISTING_SYMBOL' case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), ])) check_case_and_suite( self, symbol_command_arguments=symbol_args.individual__references( case_with_single_def.name, not_the_name_of_an_existing_symbol, ), arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.is_result_for_empty_stdout( exit_values.EXECUTION__HARD_ERROR.exit_code))
def test_single_reference_in_act_phase(self): name_of_existing_symbol = 'STRING_SYMBOL' reference_source = sym_def.reference_to(name_of_existing_symbol, ValueType.STRING) case_with_single_def = File( 'test.xly', lines_content([ phase_names.SETUP.syntax, sym_def.define_string(name_of_existing_symbol, 'value'), phase_names.ACT.syntax, reference_source, ])) expected_reference_output = output.Reference(phase_identifier.ACT, None, [ reference_source, ]) check_case_and_suite( self, symbol_command_arguments=symbol_args.individual__references( case_with_single_def.name, name_of_existing_symbol, ), arrangement=Arrangement( cwd_contents=DirContents([ case_with_single_def, ]), main_program_config=sym_def.main_program_config(), ), expectation=asrt_proc_result.sub_process_result( exitcode=asrt.equals(exit_codes.EXIT_OK), stdout=asrt.equals( lines_content(expected_reference_output.output_lines()))))
def tmp_dir(contents: DirContents = empty_dir_contents()) -> pathlib.Path: with tempfile.TemporaryDirectory() as dir_name: dir_path = resolved_path(dir_name) contents.write_to(dir_path) yield dir_path