Пример #1
0
    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,
                    )
Пример #2
0
    def test_file_is_directory_with_files_but_none_that_matches_name_pattern(
            self):
        name_of_directory = 'name-of-directory'
        pattern_that_matches_exactly_one_file = 'a*'

        dir_with_two_files = Dir(name_of_directory, [
            File.empty('a file'),
            File.empty('b file'),
        ])

        contents_of_relativity_option_root = DirContents([dir_with_two_files])

        instruction_argument_constructor = argument_constructor_for_num_files_check(
            int_condition(comparators.EQ, 1),
            name_option_pattern=pattern_that_matches_exactly_one_file)

        self.checker.check_parsing_with_different_source_variants(
            instruction_argument_constructor,
            model.model_with_source_path_as_sub_dir_of_rel_root(
                name_of_directory),
            default_relativity=RelOptionType.REL_CWD,
            non_default_relativity=RelOptionType.REL_TMP,
            main_result_for_positive_expectation=PassOrFail.PASS,
            contents_of_relativity_option_root=
            contents_of_relativity_option_root,
        )
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
    def _phase_instructions_in_suite_not_containing_cases(self):
        # ARRANGE #

        files = Files(self._phase_config())

        containing_suite_file = File(
            'sub.suite', files.suite_with_phase_instruction_and_cases)
        non_containing_suite_file = File(
            'main.suite',
            files.suite_with_phase_instruction_but_with_just_a_suite(
                containing_suite_file.file_name))

        suite_and_case_files = DirContents([
            non_containing_suite_file,
            containing_suite_file,
            files.file_1_with_registering_instruction,
            files.file_2_with_registering_instruction,
        ])

        expectation = self._expected_recordings_assertion(
            containing_suite_file.name,
            files.file_1_with_registering_instruction.name,
            files.file_2_with_registering_instruction.name,
        )

        # ACT & ASSERT #
        self._check(containing_suite_file, suite_and_case_files, expectation)
 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'),
     ])
Пример #7
0
    def __init__(self, phase_config: PhaseConfig):
        self.phase_config = phase_config

        self.file_1_with_registering_instruction = File(
            '1.case',
            CASE_THAT_REGISTERS_MARKER.format(
                case_phase_header=self.phase_config.phase_name().syntax,
                phase_contents_line_that_records=self.phase_config.
                phase_contents_line_that_registers(
                    INSTRUCTION_MARKER_IN_CASE_1)))

        self.file_2_with_registering_instruction = File(
            '2.case',
            CASE_THAT_REGISTERS_MARKER.format(
                case_phase_header=self.phase_config.phase_name().syntax,
                phase_contents_line_that_records=self.phase_config.
                phase_contents_line_that_registers(
                    INSTRUCTION_MARKER_IN_CASE_2)))

        self.suite_with_phase_instruction_and_cases = SUITE_WITH_PHASE_INSTRUCTION_AND_CASES.format(
            case_phase_header=self.phase_config.phase_name().syntax,
            phase_contents_line_that_records=self.phase_config.
            phase_contents_line_that_registers(
                INSTRUCTION_MARKER_IN_CONTAINING_SUITE),
            case_1_file=self.file_1_with_registering_instruction.file_name,
            case_2_file=self.file_2_with_registering_instruction.file_name,
        )
Пример #8
0
 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(),
                 ),
             )
Пример #9
0
 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(),
                 )
             )
Пример #10
0
class SelectorShouldBeApplied(MultipleExecutionCasesGenerator):
    min_depth = 1
    max_depth = 1

    num_regular_files_eq_1 = [
        Dir('lvl0', [
            File.empty('lvl1-included'),
            Dir('lvl1-not-included', [
                File.empty('lvl2-not-included-file'),
                Dir.empty('lvl2-not-included-dir'),
            ])
        ])
    ]
    num_regular_files_eq_2 = [
        Dir('lvl0', [
            File.empty('lvl1-included-1'),
            File.empty('lvl1-included-2'),
            Dir('lvl1-not-included', [
                File.empty('lvl2-not-included-file'),
                Dir.empty('lvl2-not-included-dir'),
            ])
        ])
    ]

    num_files_setup = NumFilesSetup(comparators.EQ, 2, [
        NEA(
            'not match',
            False,
            num_regular_files_eq_1,
        ),
        NEA(
            'match',
            True,
            num_regular_files_eq_2,
        ),
    ])

    def arguments(self) -> FileMatcherArg:
        return _as_arguments(
            RecWLimArguments(
                fms_args.Selection(fm_args.Type(FileType.REGULAR),
                                   self.num_files_setup.num_files_arg()),
                self.min_depth,
                self.max_depth,
            ))

    def expected_symbols(self) -> Sequence[Assertion[SymbolReference]]:
        return ()

    def execution_cases(
            self) -> Sequence[NExArr[ExecutionResult, Arrangement]]:
        return [
            NExArr(
                num_files_setup.name,
                FullExecutionResult(num_files_setup.expected),
                Arrangement(tcds=self._helper.
                            tcds_arrangement_for_contents_of_checked_dir(
                                num_files_setup.actual)))
            for num_files_setup in self.num_files_setup.cases
        ]
Пример #11
0
 def test_copy_directory(self):
     src_path_arg = defs.DEFAULT_SRC_REL_OPT.path_argument_of_rel_name('existing-dir')
     files_to_install = DirContents([Dir(src_path_arg.name,
                                         [File('a', 'a'),
                                          Dir('d', []),
                                          Dir('d2',
                                              [File('f', 'f')])
                                          ])])
     for execution_checker in _EXECUTION_CHECKERS:
         with self.subTest(parser=execution_checker.name):
             execution_checker.value.check(
                 self,
                 args.copy(src_path_arg).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(
                             files_to_install),
                     ),
                 ),
                 Expectation.phase_agnostic_2(
                     main_side_effects_on_sds=sds_contents_check.cwd_contains_exactly(
                         files_to_install)
                 )
             )
Пример #12
0
 def file_structure(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File('main.suite', lines_content(['[cases]', '_[!a-bx].case'])),
         File.empty('_b.case'),
         File.empty('_x.case'),
         File.empty('_a.case'),
         File.empty('_c.case'),
     ])
Пример #13
0
 def test_all_files_in_dir_WHEN_argument_is_glob_including_all_files(self):
     file_1 = File.empty('1-file.ext')
     file_2 = File.empty('2-file.ext')
     self._expect_success(contents_dir_contents=DirContents(
         [file_1, file_2]),
                          source='*',
                          expected_contents_rel_contents_dir=[
                              file_1.name_as_path,
                              file_2.name_as_path,
                          ])
    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)
Пример #15
0
 def file_structure_to_read(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File(
             'main.suite',
             lines_content([
                 section_names.CASES.syntax,
                 'case-with-invalid-content.case',
             ])),
         File('case-with-invalid-content.case',
              'invalid content in test case'),
     ])
Пример #16
0
def assert_dir_contains_exactly_result_files(expected: SubProcessResult,
                                             file_names: FileNames = process_output_files.FILE_NAMES
                                             ) -> Assertion:
    return fa.dir_contains_exactly(DirContents([
        File(file_names.exit_code,
             str(expected.exitcode)),
        File(file_names.stdout,
             expected.stdout),
        File(file_names.stderr,
             expected.stderr),
    ]))
Пример #17
0
class ReferencedInclusionDirectiveFileInIncludedFileDoesNotExist(
        check_exception.Setup):
    file_1_invalid_inclusion_line = ' '.join(
        [INCLUDING_DIRECTIVE_INFO.singular_name, 'does-not-exist.txt'])

    file_1 = File('1.xly', lines_content([file_1_invalid_inclusion_line]))

    root_suite_inclusion_line = ' '.join(
        [INCLUDING_DIRECTIVE_INFO.singular_name, file_1.name])
    inclusion_line_in_file_1 = single_line_sequence(
        1, file_1_invalid_inclusion_line)

    root_suite_file = File(
        '0.suite',
        lines_content([
            phase_names.CLEANUP.syntax,
            root_suite_inclusion_line,
        ]))
    inclusion_line_in_root_file = single_line_sequence(
        2, root_suite_inclusion_line)

    expected_source_location_path = SourceLocationPath(
        SourceLocation(
            inclusion_line_in_file_1,
            file_1.name_as_path,
        ), [
            SourceLocation(
                inclusion_line_in_root_file,
                root_suite_file.name_as_path,
            )
        ])

    def root_suite_based_at(self, root_path: pathlib.Path) -> pathlib.Path:
        return self.root_suite_file.name_as_path

    def file_structure_to_read(self) -> DirContents:
        return DirContents([self.root_suite_file, self.file_1])

    def check_exception(self, root_path: pathlib.Path, actual: Exception,
                        put: unittest.TestCase):
        put.assertIsInstance(actual, SuiteParseError)

        expectation = matches_suite_parse_error(
            suite_file=asrt.equals(self.root_suite_based_at(root_path)),
            maybe_section_name=asrt.equals(phase_names.CLEANUP.plain),
            source=equals_line_sequence(self.inclusion_line_in_file_1),
            source_location=equals_source_location_path(
                self.expected_source_location_path),
            document_parser_exception=asrt.is_instance(
                sec_doc_exceptions.FileAccessError),
        )

        expectation.apply(put, actual)
Пример #18
0
 def file_structure_to_read(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File(
             'main.suite',
             lines_content([
                 section_names.CASES.syntax,
                 '1.case',
                 'sub/2.case',
             ])),
         File.empty('1.case'),
         Dir('sub', [File.empty('2.case')])
     ])
Пример #19
0
 def file_structure(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File('main.suite', lines_content(['[cases]', 'the.case'])),
         File(
             'the.case',
             lines_content([
                 '[act]', 'system-under-test', '[assert]',
                 'exit-code {eq} 0'.format(eq=comparators.EQ.name)
             ])),
         python_executable_file('system-under-test',
                                PYTHON_PROGRAM_THAT_EXISTS_WITH_STATUS_0)
     ])
Пример #20
0
 def file_structure_to_read(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         Dir('main-sub-dir', [
             File(
                 'main.suite',
                 lines_content([
                     section_names.CASES.syntax,
                     '../main.case',
                 ])),
         ]),
         File.empty('main.case'),
     ])
Пример #21
0
 def test_one_empty_and_one_non_empty_file(self):
     self.instruction_checker.check_expectation_type_variants(
         self.for_all__empty__arguments,
         model.model_with_source_path_as_sub_dir_of_rel_root(self.name_of_checked_dir),
         main_result_for_positive_expectation=PassOrFail.FAIL,
         root_dir_of_dir_contents=AN_ACCEPTED_SDS_REL_OPT_CONFIG,
         contents_of_relativity_option_root=DirContents([
             Dir(self.name_of_checked_dir, [
                 File.empty('empty-file.txt'),
                 File('non-empty-file.txt', 'contents of non-empty file'),
             ]),
         ]),
     )
Пример #22
0
 def file_structure_to_read(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File(
             'main.suite',
             lines_content([
                 section_names.SUITES.syntax,
                 str(root_path / '1.suite'),
                 section_names.CASES.syntax,
                 str(root_path / '1.case'),
             ])),
         File.empty('1.suite'),
         File.empty('1.case'),
     ])
Пример #23
0
    def test_WHEN_multiple_selectors_THEN_selection_SHOULD_be_conjunction_of_selectors(
            self):
        # ARRANGE #

        prefix_to_include = 'A'
        file_type_to_include = FileType.DIRECTORY

        name = prefix_to_include + '-matching-base-name'
        file_name = prefix_to_include + '-matching-base-name--file'
        name1 = prefix_to_include + 'dir-in-dir-matching-base-name'
        name2 = prefix_to_include + '-matching-base-name--dir-in-dir'
        name3 = prefix_to_include + '-matching-base-name'
        name4 = prefix_to_include + '-matching-base-name--empty-dir'
        actual_cases = [
            NameAndValue(
                'empty',
                [],
            ),
            NameAndValue(
                'single regular file that matches on base name',
                [File.empty(name)],
            ),
            NameAndValue(
                'single dir that matches on base name',
                [Dir.empty(name3)],
            ),
            NameAndValue(
                'single dir that not matches on base name',
                [Dir.empty('non-matching-base-name')],
            ),
            NameAndValue('directories with contents - one level', [
                File.empty(file_name),
                Dir.empty(name4),
                Dir('non-matching-name-non-empty-dir', [
                    File.empty('file-in-dir'),
                    Dir.empty(name1),
                ]),
                Dir(prefix_to_include + '-matching-base-name--non-empty-dir', [
                    File.empty('file-in-dir'),
                    Dir.empty(name2),
                ]),
            ]),
        ]

        cases = test_data.strip_file_type_info_s(
            test_data.filter_on_file_type(
                file_type_to_include,
                test_data.filter_on_base_name_prefix(prefix_to_include, [
                    test_data.expected_is_direct_contents_of_actual(
                        case.name, case.value) for case in actual_cases
                ])))
Пример #24
0
    def _run(self, suite_file_name: str,
             run_as_part_of_explicit_suite: Optional[Path]):
        # ARRANGE #

        default_test_case_handling = setup_with_null_act_phase_and_null_preprocessing(
        )

        conf_parser_with_no_instructions = configuration_section_parser({})

        test_case_definition = test_case_definition_with_only_assert_phase_instructions(
            [])

        case_file = File.empty('test.case')

        suite_file = File(
            suite_file_name,
            lines_content([
                phase_names.ASSERT.syntax,
                ' '.join([
                    INCLUDING_DIRECTIVE_INFO.singular_name,
                    'non-existing-file.txt'
                ]),
            ]))

        suite_and_case_files = DirContents([
            suite_file,
            case_file,
        ])

        processor = sut.Processor(
            test_case_definition,
            os_services_access.new_for_cmd_exe(
                CommandExecutorThatJustReturnsConstant()),
            conf_parser_with_no_instructions, 2**10)

        with tmp_dir_as_cwd(suite_and_case_files) as tmp_dir:
            execution_settings = TestCaseExecutionSettings(
                case_file.name_as_path,
                tmp_dir,
                ReportingOption.STATUS_CODE,
                default_test_case_handling,
                run_as_part_of_explicit_suite=run_as_part_of_explicit_suite)
            # ACT #
            actual_result = capture_output_from_processor(
                processor, execution_settings)

        # ASSERT #

        expectation = is_result_for_exit_value(
            exit_values.NO_EXECUTION__FILE_ACCESS_ERROR)
        expectation.apply_without_message(self, actual_result)
Пример #25
0
    def test_definition_in_suite_and_case(self):
        # ARRANGE #

        symbol_in_suite = 'SUITE_STRING_SYMBOL'
        symbol_in_case__before_preproc = 'CASE_STRING_SYMBOL__BEFORE_PRE_PROC'
        symbol_in_case__after_preproc = 'CASE_STRING_SYMBOL'

        suite_with_preprocessor = File(
            'with-preprocessor.suite',
            lines_content([
                section_names.CONFIGURATION.syntax,
                suite_instructions.set_search_replace_preprocessor(
                    symbol_in_case__before_preproc,
                    symbol_in_case__after_preproc),
                phase_names.SETUP.syntax,
                sym_def.define_string(symbol_in_suite, 'suite-value'),
            ]))

        case_with_single_def = File(
            'test.case',
            lines_content([
                phase_names.SETUP.syntax,
                sym_def.define_string(symbol_in_case__before_preproc,
                                      'case-value'),
            ]))

        # ACT & ASSERT #

        test_with_files_in_tmp_dir.check(
            self,
            command_line_arguments=symbol_args.explicit_suite_and_case(
                suite_with_preprocessor.name, case_with_single_def.name),
            arrangement=Arrangement(
                cwd_contents=DirContents([
                    suite_with_preprocessor,
                    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(symbol_in_suite,
                                             ValueType.STRING,
                                             num_refs=0),
                        output.SymbolSummary(symbol_in_case__after_preproc,
                                             ValueType.STRING,
                                             num_refs=0),
                    ])),
            ))
 def file_structure(self, root_path: pathlib.Path) -> DirContents:
     exe_file = python_executable_file('executable-file',
                                       PYTHON_PROGRAM_THAT_EXISTS_WITH_STATUS_0)
     instruction_that_runs_program = '{run} {exe_file}'.format(
         run=instruction_names.RUN_INSTRUCTION_NAME,
         exe_file=exe_file.name,
     )
     return DirContents([
         File('main.suite', lines_content(['[cases]', 'the.case'])),
         File('the.case', lines_content(['[setup]',
                                         instruction_that_runs_program,
                                         ])),
         exe_file
     ])
Пример #27
0
 def file_structure(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File(
             'main.suite',
             lines_content(
                 ['[suites]', 'sub.suite', '[cases]', 'main.case'])),
         File('main.case', ''),
         File(
             'sub.suite',
             lines_content(
                 ['[suites]', 'sub-sub.suite', '[cases]', 'sub.case'])),
         File('sub.case', ''),
         File('sub-sub.suite', ''),
     ])
Пример #28
0
 def file_structure(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File('main.suite', lines_content(['[cases]', 'the.case'])),
         File(
             'the.case',
             lines_content([
                 '[conf]',
                 '[setup]',
                 '[act]',
                 '[assert]',
                 '[before-assert]',
                 '[cleanup]',
             ])),
     ])
Пример #29
0
 def file_structure(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File(
             'main.suite',
             lines_content(
                 ['[cases]', 'sub-dir-1/?.case', 'sub-dir-2/*.case'])),
         Dir('sub-dir-1', [
             File.empty('b.case'),
             File.empty('a.case'),
         ]),
         Dir('sub-dir-2', [
             File.empty('22.case'),
             File.empty('11.case'),
         ]),
     ])
Пример #30
0
 def file_structure_to_read(self, root_path: pathlib.Path) -> DirContents:
     return DirContents([
         File(
             'main.suite',
             lines_content([
                 section_names.SUITES.syntax,
                 'sub-dir/sub.suite',
             ])),
         Dir('sub-dir', [
             File('sub.suite', lines_content([
                 'sub.case',
             ])),
             File.empty('sub.case')
         ])
     ])